xref: /original-bsd/sys/news3400/bm/vt100.h (revision cbbda00f)
1 /*
2  * Copyright (c) 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Sony Corp. and Kazumasa Utashiro of Software Research Associates, Inc.
7  *
8  * %sccs.include.redist.c%
9  *
10  * from: $Hdr: vt100.h,v 4.300 91/06/09 06:14:58 root Rel41 $ SONY
11  *
12  *	@(#)vt100.h	8.1 (Berkeley) 06/10/93
13  */
14 
15 /*
16  *  vt100 emulator header
17  */
18 
19 #include <news3400/bm/vt100esc.h>
20 
21 /*
22  *  terminal mode
23  */
24 #define	KAM		0x00000001	/*  k-action(lock or not) */
25 #define	IRM		0x00000002	/*  insert mode 	*/
26 #define	SRM		0x00000004	/*  local echo disable	*/
27 #define	LNM		0x00000008	/*  new line mode	*/
28 #define	DECCKM		0x00000010	/*  cursor application	*/
29 #define	DECCOLM		0x00000020	/*  132 column mode	*/
30 #define	DECSCLM		0x00000040	/*  jump scroll		*/
31 #define	DECSCNM		0x00000080	/*  screen reverse	*/
32 #define	DECOM		0x00000100	/*  origin mode		*/
33 #define	DECAWM		0x00000200	/*  auto wrap mode	*/
34 #define	DECARM		0x00000400	/*  auto repeat mode	*/
35 #define	DECKPA_NM	0x00000800	/*  ten key application	*/
36 #define	DECCSR_ACTV	0x00001000	/*  cursor active	*/
37 
38 
39 /*
40  *  cursor attributes
41  */
42 #define	NORMALM		0x0000		/*  attributes clear	*/
43 #define	BOLD		0x0001		/*  bold	*/
44 #define	USCORE		0x0002		/*  under line	*/
45 #define	BLINK		0x0004		/*  blinking	*/
46 #define	REVERSE		0x0008		/*  reverse	*/
47 
48 
49 /*
50  *  cursor current status
51  */
52 #define	ESCAPE	0x00000001		/*  processing esc sequence	*/
53 #define	WRAP	0x00000002		/*  local flag in addch()	*/
54 #define	SKANJI	0x00000004		/*  receive kanji shift jis code  */
55 #define	JKANJI	0x00000008		/*  kanji mode (JIS)	*/
56 #define EKANA	0x00000010
57 #define EKANJI	0x00000020
58 
59 /*
60  *  shift jis code conversion table
61  */
62 #define	JVR1S	0x81	/*  starting of vertical range  1	*/
63 #define	JVR1E	0x9f	/*  ending of vertical range  1		*/
64 #define	JVR2S	0xe0	/*  starting of vertical range  2	*/
65 #define JVR2E	0xfc	/*  ending of vertical range  2		*/
66 #define	JHR1S	0x40	/*  starting of horizontal range  1	*/
67 #define	JHR1E	0x7e	/*  ending of horizontal range  1	*/
68 #define	JHR2S	0x80	/*  starting of horizontal range  2	*/
69 #define	JHR2E	0x9e	/*  ending of horizontal range  2	*/
70 #define	JHR3S	0x9f	/*  starting of horizontal range  3	*/
71 #define JHR3E	0xfc	/*  ending of horizontal range  3	*/
72 
73 /*
74  *  EUC conversion table
75  */
76 #define SS2	0x8e
77 #define	CS1S	0xa1
78 #define CS1E	0xfe
79 
80 
81 /*
82  *  screen width
83  */
84 #define	TOP_M	1		/*  screen top margin	*/
85 #define	LFT_M	1		/*  screen left margin	*/
86 
87 /*
88  *  default value
89  */
90 #define	DIM_CNT_DFLT	10	/*  initial dimmer count	*/
91 #define	BELL_LEN_DFLT	32	/*  bell length	*/
92 
93 /*
94  *  max and min value of above values
95  */
96 #define	FONT_W_MAX	16
97 #define	FONT_W_MIN	5
98 #define	FONT_H_MAX	32
99 #define	FONT_H_MIN	8
100 #define	CHAR_W_MAX	16
101 #define	CHAR_W_MIN	6
102 #define	CHAR_H_MAX	32
103 #define	CHAR_H_MIN	9
104 #define	CH_POS_MAX	32
105 #define	CH_POS_MIN	0
106 #define	UL_POS_MAX	32
107 #define	UL_POS_MIN	0
108 #define	SCR_W_MAX	1024
109 #define	SCR_W_MIN	0
110 #define	SCR_H_MAX	1024
111 #define	SCR_H_MIN	0
112 #define	X_OFST_MAX	1024
113 #define	X_OFST_MIN	0
114 #define	Y_OFST_MAX	1024
115 #define	Y_OFST_MIN	0
116 #define	RIT_M_MAX	136
117 #define	RIT_M_MIN	2
118 #define	BTM_M_MAX	100
119 #define	BTM_M_MIN	1
120 #define	DIM_CNT_MAX	32767
121 #define	DIM_CNT_MIN	1
122 #define	BELL_LEN_MAX	19200
123 #define	BELL_LEN_MIN	1
124 
125 /*
126  *  scroll region
127  */
128 struct	region {
129 	int	top_margin;
130 	int	btm_margin;
131 };
132 
133 /*
134  *  cursor position and status
135  */
136 struct	cursor {
137 	int	csr_x;		/*  cursor position x	*/
138 	int	csr_y;		/*  cursor position y	*/
139 	lPoint	csr_p;		/*  cursor point	*/
140 	int	csr_attributes;	/*  cursor attributes	*/
141 };
142 
143 /*
144  *  screen information
145  */
146 typedef	struct	screen {
147 	int	s_term_mode;
148 	int	s_current_stat;		/*  current status	*/
149 	struct	esc_sequence  *s_estp;	/*  for escape handler	*/
150 	int	(*s_esc_handler)();
151 	int	s_plane;		/*  color bitmap plane #  */
152 	int	s_bgcol;		/*  back ground color	*/
153 	char	s_tab_pos[RIT_M_MAX + 1];	/*  tab stop position	*/
154 	struct	cursor	s_csr;
155 	struct	region	s_region;
156 } SCREEN;
157 
158 #define	ESC_BUF_SIZ	32
159 #define	PARM_BUF_SIZ	8
160 #define	AN_BUF_SIZ	32
161 
162 extern unsigned short fbuf[256];
163 extern int	fp;
164 extern int	fpn;
165 extern lPoint	fpp;
166 extern int	fpa;
167 
168 #define	INVALID	-1
169 #define	TRUE	1
170 #define	FALSE	0
171 
172 #define	C_MESS_SIZ	32
173 
174 extern	int	fcolor;
175 extern	int	bcolor;
176 
177 extern	lRectangle	char_r1;
178 extern	lRectangle	char_r2;
179 extern	lRectangle	font_r1;
180 extern	lRectangle	font_r2;
181 
182 extern	int	font_len1;
183 extern	int	font_len2;
184 
185 extern	int	char_w;
186 extern	int	char_h;
187 extern	int	char_wx2;
188 extern	int	font_w;
189 extern	int	font_h;
190 extern	int	ch_pos;
191 extern	int	ul_pos;
192 extern	int	x_ofst;
193 extern	int	y_ofst;
194 extern	int	rit_m;
195 extern	int	btm_m;
196 extern	int	scr_w;
197 extern	int	scr_h;
198 extern	int	dim_cnt;
199 extern	int	bell_len;
200 extern	int	a_dim_on;
201