/* Ported to GNU C openVMS/Alpha by Klaus Kämpf, kkaempf@progis.de  */
/* <trmdef.h>
 *
 *	Terminal extended $QIO (itemlist read) definitions
 */
#ifndef _TRMDEF_H
#define _TRMDEF_H

/* define symbols for the item list qio format
 */
/* item list type codes */
#define TRM$_MODIFIERS	0
#define TRM$_EDITMODE	1
#define TRM$_TIMEOUT	2
#define TRM$_TERM	3
#define TRM$_PROMPT	4
#define TRM$_INISTRNG	5
#define TRM$_PICSTRNG	6
#define TRM$_FILLCHR	7
#define TRM$_INIOFFSET	8
#define TRM$_ALTECHSTR	9
#define TRM$_ESCTRMOVR	10
#define TRM$_LASTITM	11	/* must remain the last item */
#define TRM$_RECLINE	31	/* reserved for exclusive use by Japanese input method */

/* editmode type codes */
#define TRM$K_EM_DEFAULT	0
#define TRM$K_EM_RDVERIFY	1
#define TRM$V_TM_NOECHO		6
#define TRM$V_TM_TIMED		7
#define TRM$V_TM_CVTLOW		8
#define TRM$V_TM_NOFILTR	9
#define TRM$V_TM_DSABLMBX	10
#define TRM$V_TM_PURGE		11
#define TRM$V_TM_TRMNOECHO	12
#define TRM$V_TM_REFRESH	13
#define TRM$V_TM_ESCAPE		14
#define TRM$V_TM_NOEDIT		15
#define TRM$V_TM_NORECALL	16
#define TRM$V_TM_R_JUST		17
#define TRM$V_TM_AUTO_TAB	18
#define TRM$V_TM_ARROWS		19
#define TRM$V_TM_TERM_ARROW	20
#define TRM$V_TM_TERM_DEL	21
#define TRM$V_TM_TOGGLE		22
#define TRM$V_TM_OTHERWAY	23
#define TRM$V_TM_NOCLEAR	24
#define TRM$M_TM_NOECHO		(1<<TRM$V_TM_NOECHO)	    /* 0x0040 */
#define TRM$M_TM_TIMED		(1<<TRM$V_TM_TIMED)	    /* 0x0080 */
#define TRM$M_TM_CVTLOW		(1<<TRM$V_TM_CVTLOW)	    /* 0x0100 */
#define TRM$M_TM_NOFILTR	(1<<TRM$V_TM_NOFILTR)	    /* 0x0200 */
#define TRM$M_TM_DSABLMBX	(1<<TRM$V_TM_DSABLMBX)	    /* 0x0400 */
#define TRM$M_TM_PURGE		(1<<TRM$V_TM_PURGE)	    /* 0x0800 */
#define TRM$M_TM_TRMNOECHO	(1<<TRM$V_TM_TRMNOECHO)     /* 0x1000 */
#define TRM$M_TM_REFRESH	(1<<TRM$V_TM_REFRESH)	    /* 0x2000 */
#define TRM$M_TM_ESCAPE		(1<<TRM$V_TM_ESCAPE)	    /* 0x4000 */
#define TRM$M_TM_NOEDIT		(1<<TRM$V_TM_NOEDIT)	    /* 0x8000 */
#define TRM$M_TM_NORECALL	(1<<TRM$V_TM_NORECALL)	    /* 0x00010000 */
#define TRM$M_TM_R_JUST		(1<<TRM$V_TM_R_JUST)	    /* 0x00020000 */
#define TRM$M_TM_AUTO_TAB	(1<<TRM$V_TM_AUTO_TAB)	    /* 0x00040000 */
#define TRM$M_TM_ARROWS		(1<<TRM$V_TM_ARROWS)	    /* 0x00080000 */
#define TRM$M_TM_TERM_ARROW	(1<<TRM$V_TM_TERM_ARROW)    /* 0x00100000 */
#define TRM$M_TM_TERM_DEL	(1<<TRM$V_TM_TERM_DEL)	    /* 0x00200000 */
#define TRM$M_TM_TOGGLE		(1<<TRM$V_TM_TOGGLE)	    /* 0x00400000 */
#define TRM$M_TM_OTHERWAY	(1<<TRM$V_TM_OTHERWAY)	    /* 0x00800000 */
#define TRM$M_TM_NOCLEAR	(1<<TRM$V_TM_NOCLEAR)	    /* 0x01000000 */
#define TRM$V_CV_UPPER		0
#define TRM$V_CV_LOWER		1
#define TRM$V_CV_NUMERIC	2
#define TRM$V_CV_NUMPUNC	3
#define TRM$V_CV_PRINTABLE	4
#define TRM$V_CV_ANY		5
#define TRM$M_CV_UPPER		(1<<TRM$V_CV_UPPER)	    /* 0x01 */
#define TRM$M_CV_LOWER		(1<<TRM$V_CV_LOWER)	    /* 0x02 */
#define TRM$M_CV_NUMERIC	(1<<TRM$V_CV_NUMERIC)	    /* 0x04 */
#define TRM$M_CV_NUMPUNC	(1<<TRM$V_CV_NUMPUNC)	    /* 0x08 */
#define TRM$M_CV_PRINTABLE	(1<<TRM$V_CV_PRINTABLE)     /* 0x10 */
#define TRM$M_CV_ANY		(1<<TRM$V_CV_ANY)	    /* 0x20 */
#define TRM$V_ST_FIELD_FULL	0
#define TRM$V_ST_OTHERWAY	1
#define TRM$M_ST_FIELD_FULL	(1<<TRM$V_ST_FIELD_FULL)    /* 0x01 */
#define TRM$M_ST_OTHERWAY	(1<<TRM$V_ST_OTHERWAY)	    /* 0x02 */
union trmdef {
    struct {
	unsigned		    : 6; /* function code */
	unsigned trm$v_tm_noecho    : 1; /* noecho */
	unsigned trm$v_tm_timed     : 1; /* timed */
	unsigned trm$v_tm_cvtlow    : 1; /* convert lower case */
	unsigned trm$v_tm_nofiltr   : 1; /* no filter */
	unsigned trm$v_tm_dsablmbx  : 1; /* disable mailbox */
	unsigned trm$v_tm_purge     : 1; /* purge typeahead */
	unsigned trm$v_tm_trmnoecho : 1; /* terminators are not echoed */
	unsigned trm$v_tm_refresh   : 1; /* control-R interrupted read n */
	unsigned trm$v_tm_escape    : 1; /* terminate read on escape sequence */
	unsigned trm$v_tm_noedit    : 1; /* disable advanced editing */
	unsigned trm$v_tm_norecall  : 1; /* disable the recall feature of advanced editing */
	unsigned trm$v_tm_r_just    : 1; /* right justification */
	unsigned trm$v_tm_auto_tab  : 1; /* Auto tab field */
	unsigned trm$v_tm_arrows    : 1; /* enable left & right arrow keys */
	unsigned trm$v_tm_term_arrow: 1; /* pass arrows as terminator */
	unsigned trm$v_tm_term_del  : 1; /* pass <DEL> as terminator */
	unsigned trm$v_tm_toggle    : 1; /* allow insert/overstrike toggle */
	unsigned trm$v_tm_otherway  : 1; /* overstrike R-justify or insert L-justify */
	unsigned trm$v_tm_noclear   : 1; /* don't replace fill with clear after first non-fill */
	unsigned		    : 7;
    } trm$r_trmdef_bits0;
    struct {			/* picture string mask */
	unsigned char trm$v_cv_upper     : 1; /* upper case */
	unsigned char trm$v_cv_lower     : 1; /* lower case */
	unsigned char trm$v_cv_numeric   : 1; /* numeric (0-9) */
	unsigned char trm$v_cv_numpunc   : 1; /* numeric punctuation (+ - .) */
	unsigned char trm$v_cv_printable : 1; /* printable character */
	unsigned char trm$v_cv_any	 : 1; /* any character */
	unsigned char			 : 2;
    } trm$r_trmdef_bits1;
    struct {
	unsigned char trm$v_st_field_full: 1; /* field full condition IOSB+7 contains index to cursor */
	unsigned char trm$v_st_otherway  : 1; /* left-justify insert OR right-justify overstrike */
	unsigned char			 : 6;
    } trm$r_trmdef_bits2;
};

#endif	/*_TRMDEF_H*/
