Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
BitchX
GitHub Repository: BitchX/BitchX1.3
Path: blob/master/include/ircterm.h
1069 views
1
/*
2
* term.h: header file for term.c
3
*
4
* Written By Michael Sandrof
5
*
6
* Copyright(c) 1990
7
*
8
* See the COPYRIGHT file, or do a HELP IRCII COPYRIGHT
9
*
10
* @(#)$Id: ircterm.h 3 2008-02-25 09:49:14Z keaston $
11
*/
12
13
#ifndef _TERM_H_
14
# define _TERM_H_
15
16
#ifdef HAVE_NCURSES_H
17
# include <ncurses.h>
18
# ifdef HAVE_NCURSES_TERMCAP_H
19
# include <ncurses/termcap.h>
20
# elif defined(HAVE_TERMCAP_H)
21
# ifndef __CYGWIN__
22
# include <termcap.h>
23
# endif
24
# endif
25
#else
26
# ifdef HAVE_CURSES_H
27
# include <curses.h>
28
# endif
29
# ifdef HAVE_TERMCAP_H
30
# include <termcap.h>
31
# endif
32
#endif
33
#ifdef __EMX__
34
#include <termcap.h>
35
#endif
36
37
#include "irc_std.h"
38
#include "screen.h"
39
40
extern int need_redraw;
41
extern int meta_mode;
42
43
/*
44
* This puts a character to the current target, whatever it is.
45
* All output everywhere should go through this.
46
* This does not mangle its output, so its suitable for outputting
47
* escape sequences.
48
*/
49
#if !defined(WTERM_C) && !defined(WSERV_C)
50
#define current_ftarget (output_screen ? output_screen->fpout : stdout)
51
52
#ifdef __EMXPM__
53
void avio_set_var(int aviovar, int value);
54
int avio_get_var(int aviovar);
55
void avio_refresh_screen(void);
56
#define AVIOREDRAW 1
57
#define AVIORESIZED 2
58
#define AVIOINSELECT 3
59
#define AVIOINWMCHAR 4
60
#endif
61
62
#ifdef GUI
63
#include "gui.h"
64
#endif
65
66
#ifdef TRANSLATE
67
#include "translat.h"
68
__inline__
69
static int putchar_x (int c) {
70
#ifdef GUI
71
#if 1
72
return gui_putc((int) (translation ? transToClient[c] : c));
73
#else
74
return gui_putc((int) c);
75
#endif
76
#else
77
#if 1
78
return fputc((int) (translation ? transToClient[c] : c), current_ftarget);
79
#else
80
return fputc((int) c, current_ftarget);
81
#endif
82
#endif
83
}
84
#else
85
__inline__
86
static int putchar_x (int c) {
87
#ifdef GUI
88
return gui_putc((int) c);
89
#else
90
return fputc((unsigned int) c, current_ftarget);
91
#endif
92
}
93
#endif
94
95
__inline__
96
static void term_flush (void) { fflush(current_ftarget); }
97
98
#define TERM_SGR_BOLD_ON 1
99
#define TERM_SGR_BOLD_OFF 2
100
#define TERM_SGR_BLINK_ON 3
101
#define TERM_SGR_BLINK_OFF 4
102
#define TERM_SGR_UNDL_ON 5
103
#define TERM_SGR_UNDL_OFF 6
104
#define TERM_SGR_REV_ON 7
105
#define TERM_SGR_REV_OFF 8
106
#define TERM_SGR_NORMAL 9
107
#define TERM_SGR_RESET 10
108
#define TERM_SGR_FOREGROUND 11
109
#define TERM_SGR_BACKGROUND 12
110
#define TERM_SGR_GCHAR 13
111
#define TERM_SGR_ALTCHAR_ON 14
112
#define TERM_SGR_ALTCHAR_OFF 15
113
#define TERM_SGR_MAXVAL 16
114
115
#define TERM_CAN_CUP 1 << 0
116
#define TERM_CAN_CLEAR 1 << 1
117
#define TERM_CAN_CLREOL 1 << 2
118
#define TERM_CAN_RIGHT 1 << 3
119
#define TERM_CAN_LEFT 1 << 4
120
#define TERM_CAN_SCROLL 1 << 5
121
#define TERM_CAN_DELETE 1 << 6
122
#define TERM_CAN_INSERT 1 << 7
123
#define TERM_CAN_DELLINES 1 << 8
124
#define TERM_CAN_INSLINES 1 << 9
125
#define TERM_CAN_REPEAT 1 << 10
126
#define TERM_CAN_BOLD 1 << 11
127
#define TERM_CAN_BLINK 1 << 12
128
#define TERM_CAN_UNDL 1 << 13
129
#define TERM_CAN_REVERSE 1 << 14
130
#define TERM_CAN_COLOR 1 << 15
131
#define TERM_CAN_GCHAR 1 << 16
132
133
#if 0
134
extern char *TI_cr, *TI_nl;
135
extern int TI_lines, TI_cols;
136
extern char *TI_sgrstrs[];
137
extern char *TI_forecolors[];
138
extern char *TI_backcolors[];
139
#endif
140
141
extern int termfeatures;
142
143
144
/* Our variable name Cap / Info Description */
145
146
struct term_struct {
147
int TI_bw; /* bw / bw cub1 wraps from column 0 to last column */
148
int TI_am; /* am / am terminal has automatic margins */
149
int TI_xsb; /* xb / xsb beehive (f1=escape, f2=ctrl C) */
150
int TI_xhp; /* xs / xhp standout not erased by overwriting (hp) */
151
int TI_xenl; /* xn / xenl newline ignored after 80 cols (concept) */
152
int TI_eo; /* eo / eo can erase overstrikes with a blank */
153
int TI_gn; /* gn / gn generic line type */
154
int TI_hc; /* hc / hc hardcopy terminal */
155
int TI_km; /* km / km Has a meta key (shift, sets parity bit) */
156
int TI_hs; /* hs / hs has extra status line */
157
int TI_in; /* in / in insert mode distinguishes nulls */
158
int TI_da; /* da / da display may be retained above the screen */
159
int TI_db; /* db / db display may be retained below the screen */
160
int TI_mir; /* mi / mir safe to move while in insert mode */
161
int TI_msgr; /* ms / msgr safe to move while in standout mode */
162
int TI_os; /* os / os terminal can overstrike */
163
int TI_eslok; /* es / eslok escape can be used on the status line */
164
int TI_xt; /* xt / xt tabs destructive, magic so char (t1061) */
165
int TI_hz; /* hz / hz can't print ~'s (hazeltine) */
166
int TI_ul; /* ul / ul underline character overstrikes */
167
int TI_xon; /* xo / xon terminal uses xon/xoff handshaking */
168
int TI_nxon; /* nx / nxon padding won't work, xon/xoff required */
169
int TI_mc5i; /* 5i / mc5i printer won't echo on screen */
170
int TI_chts; /* HC / chts cursor is hard to see */
171
int TI_nrrmc; /* NR / nrrmc smcup does not reverse rmcup */
172
int TI_npc; /* NP / npc pad character does not exist */
173
int TI_ndscr; /* ND / ndscr scrolling region is non-destructive */
174
int TI_ccc; /* cc / ccc terminal can re-define existing colors */
175
int TI_bce; /* ut / bce screen erased with background color */
176
int TI_hls; /* hl / hls terminal uses only HLS color notation (Tektronix) */
177
int TI_xhpa; /* YA / xhpa only positive motion for hpa/mhpa caps */
178
int TI_crxm; /* YB / crxm using cr turns off micro mode */
179
int TI_daisy; /* YC / daisy printer needs operator to change character set */
180
int TI_xvpa; /* YD / xvpa only positive motion for vpa/mvpa caps */
181
int TI_sam; /* YE / sam printing in last column causes cr */
182
int TI_cpix; /* YF / cpix changing character pitch changes resolution */
183
int TI_lpix; /* YG / lpix changing line pitch changes resolution */
184
int TI_cols; /* co / cols number of columns in a line */
185
int TI_it; /* it / it tabs initially every # spaces */
186
int TI_lines; /* li / lines number of lines on screen or page */
187
int TI_lm; /* lm / lm lines of memory if > line. 0 means varies */
188
int TI_xmc; /* sg / xmc number of blank characters left by smso or rmso */
189
int TI_pb; /* pb / pb lowest baud rate where padding needed */
190
int TI_vt; /* vt / vt virtual terminal number (CB/unix) */
191
int TI_wsl; /* ws / wsl number of columns in status line */
192
int TI_nlab; /* Nl / nlab number of labels on screen */
193
int TI_lh; /* lh / lh rows in each label */
194
int TI_lw; /* lw / lw columns in each label */
195
int TI_ma; /* ma / ma maximum combined attributes terminal can handle */
196
int TI_wnum; /* MW / wnum maximum number of defineable windows */
197
int TI_colors; /* Co / colors maximum number of colors on screen */
198
int TI_pairs; /* pa / pairs maximum number of color-pairs on the screen */
199
int TI_ncv; /* NC / ncv video attributes that can't be used with colors */
200
int TI_bufsz; /* Ya / bufsz numbers of bytes buffered before printing */
201
int TI_spinv; /* Yb / spinv spacing of pins vertically in pins per inch */
202
int TI_spinh; /* Yc / spinh spacing of dots horizontally in dots per inch */
203
int TI_maddr; /* Yd / maddr maximum value in micro_..._address */
204
int TI_mjump; /* Ye / mjump maximum value in parm_..._micro */
205
int TI_mcs; /* Yf / mcs character step size when in micro mode */
206
int TI_mls; /* Yg / mls line step size when in micro mode */
207
int TI_npins; /* Yh / npins numbers of pins in print-head */
208
int TI_orc; /* Yi / orc horizontal resolution in units per line */
209
int TI_orl; /* Yj / orl vertical resolution in units per line */
210
int TI_orhi; /* Yk / orhi horizontal resolution in units per inch */
211
int TI_orvi; /* Yl / orvi vertical resolution in units per inch */
212
int TI_cps; /* Ym / cps print rate in characters per second */
213
int TI_widcs; /* Yn / widcs character step size when in double wide mode */
214
int TI_btns; /* BT / btns number of buttons on mouse */
215
int TI_bitwin; /* Yo / bitwin number of passes for each bit-image row */
216
int TI_bitype; /* Yp / bitype type of bit-image device */
217
char *TI_cbt; /* bt / cbt back tab (P) */
218
char *TI_bel; /* bl / bel audible signal (bell) (P) */
219
char *TI_cr; /* cr / cr carriage return (P*) (P*) */
220
char *TI_csr; /* cs / csr change region to line #1 to line #2 (P) */
221
char *TI_tbc; /* ct / tbc clear all tab stops (P) */
222
char *TI_clear; /* cl / clear clear screen and home cursor (P*) */
223
char *TI_el; /* ce / el clear to end of line (P) */
224
char *TI_ed; /* cd / ed clear to end of screen (P*) */
225
char *TI_hpa; /* ch / hpa horizontal position #1, absolute (P) */
226
char *TI_cmdch; /* CC / cmdch terminal settable cmd character in prototype !? */
227
char *TI_cup; /* cm / cup move to row #1 columns #2 */
228
char *TI_cud1; /* do / cud1 down one line */
229
char *TI_home; /* ho / home home cursor (if no cup) */
230
char *TI_civis; /* vi / civis make cursor invisible */
231
char *TI_cub1; /* le / cub1 move left one space */
232
char *TI_mrcup; /* CM / mrcup memory relative cursor addressing */
233
char *TI_cnorm; /* ve / cnorm make cursor appear normal (undo civis/cvvis) */
234
char *TI_cuf1; /* nd / cuf1 non-destructive space (move right one space) */
235
char *TI_ll; /* ll / ll last line, first column (if no cup) */
236
char *TI_cuu1; /* up / cuu1 up one line */
237
char *TI_cvvis; /* vs / cvvis make cursor very visible */
238
char *TI_dch1; /* dc / dch1 delete character (P*) */
239
char *TI_dl1; /* dl / dl1 delete line (P*) */
240
char *TI_dsl; /* ds / dsl disable status line */
241
char *TI_hd; /* hd / hd half a line down */
242
char *TI_smacs; /* as / smacs start alternate character set (P) */
243
char *TI_blink; /* mb / blink turn on blinking */
244
char *TI_bold; /* md / bold turn on bold (extra bright) mode */
245
char *TI_smcup; /* ti / smcup string to start programs using cup */
246
char *TI_smdc; /* dm / smdc enter delete mode */
247
char *TI_dim; /* mh / dim turn on half-bright mode */
248
char *TI_smir; /* im / smir enter insert mode */
249
char *TI_invis; /* mk / invis turn on blank mode (characters invisible) */
250
char *TI_prot; /* mp / prot turn on protected mode */
251
char *TI_rev; /* mr / rev turn on reverse video mode */
252
char *TI_smso; /* so / smso begin standout mode */
253
char *TI_smul; /* us / smul begin underline mode */
254
char *TI_ech; /* ec / ech erase #1 characters (P) */
255
char *TI_rmacs; /* ae / rmacs end alternate character set (P) */
256
char *TI_sgr0; /* me / sgr0 turn off all attributes */
257
char *TI_rmcup; /* te / rmcup strings to end programs using cup */
258
char *TI_rmdc; /* ed / rmdc end delete mode */
259
char *TI_rmir; /* ei / rmir exit insert mode */
260
char *TI_rmso; /* se / rmso exit standout mode */
261
char *TI_rmul; /* ue / rmul exit underline mode */
262
char *TI_flash; /* vb / flash visible bell (may not move cursor) */
263
char *TI_ff; /* ff / ff hardcopy terminal page eject (P*) */
264
char *TI_fsl; /* fs / fsl return from status line */
265
char *TI_is1; /* i1 / is1 initialization string */
266
char *TI_is2; /* is / is2 initialization string */
267
char *TI_is3; /* i3 / is3 initialization string */
268
char *TI_if; /* if / if name of initialization file */
269
char *TI_ich1; /* ic / ich1 insert character (P) */
270
char *TI_il1; /* al / il1 insert line (P*) */
271
char *TI_ip; /* ip / ip insert padding after inserted character */
272
char *TI_kbs; /* kb / kbs backspace key */
273
char *TI_ktbc; /* ka / ktbc clear-all-tabs key */
274
char *TI_kclr; /* kC / kclr clear-screen or erase key */
275
char *TI_kctab; /* kt / kctab clear-tab key */
276
char *TI_kdch1; /* kD / kdch1 delete-character key */
277
char *TI_kdl1; /* kL / kdl1 delete-line key */
278
char *TI_kcud1; /* kd / kcud1 down-arrow key */
279
char *TI_krmir; /* kM / krmir sent by rmir or smir in insert mode */
280
char *TI_kel; /* kE / kel clear-to-end-of-line key */
281
char *TI_ked; /* kS / ked clear-to-end-of-screen key */
282
char *TI_kf0; /* k0 / kf0 F0 function key */
283
char *TI_kf1; /* k1 / kf1 F1 function key */
284
char *TI_kf10; /* k; / kf10 F10 function key */
285
char *TI_kf2; /* k2 / kf2 F2 function key */
286
char *TI_kf3; /* k3 / kf3 F3 function key */
287
char *TI_kf4; /* k4 / kf4 F4 function key */
288
char *TI_kf5; /* k5 / kf5 F5 function key */
289
char *TI_kf6; /* k6 / kf6 F6 function key */
290
char *TI_kf7; /* k7 / kf7 F7 function key */
291
char *TI_kf8; /* k8 / kf8 F8 function key */
292
char *TI_kf9; /* k9 / kf9 F9 function key */
293
char *TI_khome; /* kh / khome home key */
294
char *TI_kich1; /* kI / kich1 insert-character key */
295
char *TI_kil1; /* kA / kil1 insert-line key */
296
char *TI_kcub1; /* kl / kcub1 left-arrow key */
297
char *TI_kll; /* kH / kll lower-left key (home down) */
298
char *TI_knp; /* kN / knp next-page key */
299
char *TI_kpp; /* kP / kpp previous-page key */
300
char *TI_kcuf1; /* kr / kcuf1 right-arrow key */
301
char *TI_kind; /* kF / kind scroll-forward key */
302
char *TI_kri; /* kR / kri scroll-backward key */
303
char *TI_khts; /* kT / khts set-tab key */
304
char *TI_kcuu1; /* ku / kcuu1 up-arrow key */
305
char *TI_rmkx; /* ke / rmkx leave 'keyboard_transmit' mode */
306
char *TI_smkx; /* ks / smkx enter 'keyboard_transmit' mode */
307
char *TI_lf0; /* l0 / lf0 label on function key f0 if not f0 */
308
char *TI_lf1; /* l1 / lf1 label on function key f1 if not f1 */
309
char *TI_lf10; /* la / lf10 label on function key f10 if not f10 */
310
char *TI_lf2; /* l2 / lf2 label on function key f2 if not f2 */
311
char *TI_lf3; /* l3 / lf3 label on function key f3 if not f3 */
312
char *TI_lf4; /* l4 / lf4 label on function key f4 if not f4 */
313
char *TI_lf5; /* l5 / lf5 label on function key f5 if not f5 */
314
char *TI_lf6; /* l6 / lf6 label on function key f6 if not f6 */
315
char *TI_lf7; /* l7 / lf7 label on function key f7 if not f7 */
316
char *TI_lf8; /* l8 / lf8 label on function key f8 if not f8 */
317
char *TI_lf9; /* l9 / lf9 label on function key f9 if not f9 */
318
char *TI_rmm; /* mo / rmm turn off meta mode */
319
char *TI_smm; /* mm / smm turn on meta mode (8th-bit on) */
320
char *TI_nel; /* nw / nel newline (behave like cr followed by lf) */
321
char *TI_pad; /* pc / pad padding char (instead of null) */
322
char *TI_dch; /* DC / dch delete #1 characters (P*) */
323
char *TI_dl; /* DL / dl delete #1 lines (P*) */
324
char *TI_cud; /* DO / cud down #1 lines (P*) */
325
char *TI_ich; /* IC / ich insert #1 characters (P*) */
326
char *TI_indn; /* SF / indn scroll forward #1 lines (P) */
327
char *TI_il; /* AL / il insert #1 lines (P*) */
328
char *TI_cub; /* LE / cub move #1 characters to the left (P) */
329
char *TI_cuf; /* RI / cuf move #1 characters to the right (P*) */
330
char *TI_rin; /* SR / rin scroll back #1 lines (P) */
331
char *TI_cuu; /* UP / cuu up #1 lines (P*) */
332
char *TI_pfkey; /* pk / pfkey program function key #1 to type string #2 */
333
char *TI_pfloc; /* pl / pfloc program function key #1 to execute string #2 */
334
char *TI_pfx; /* px / pfx program function key #1 to transmit string #2 */
335
char *TI_mc0; /* ps / mc0 print contents of screen */
336
char *TI_mc4; /* pf / mc4 turn off printer */
337
char *TI_mc5; /* po / mc5 turn on printer */
338
char *TI_rep; /* rp / rep repeat char #1 #2 times (P*) */
339
char *TI_rs1; /* r1 / rs1 reset string */
340
char *TI_rs2; /* r2 / rs2 reset string */
341
char *TI_rs3; /* r3 / rs3 reset string */
342
char *TI_rf; /* rf / rf name of reset file */
343
char *TI_rc; /* rc / rc restore cursor to position of last save_cursor */
344
char *TI_vpa; /* cv / vpa vertical position #1 absolute (P) */
345
char *TI_sc; /* sc / sc save current cursor position (P) */
346
char *TI_ind; /* sf / ind scroll text up (P) */
347
char *TI_ri; /* sr / ri scroll text down (P) */
348
char *TI_sgr; /* sa / sgr define video attributes #1-#9 (PG9) */
349
char *TI_hts; /* st / hts set a tab in every row, current columns */
350
char *TI_wind; /* wi / wind current window is lines #1-#2 cols #3-#4 */
351
char *TI_ht; /* ta / ht tab to next 8-space hardware tab stop */
352
char *TI_tsl; /* ts / tsl move to status line */
353
char *TI_uc; /* uc / uc underline char and move past it */
354
char *TI_hu; /* hu / hu half a line up */
355
char *TI_iprog; /* iP / iprog path name of program for initialization */
356
char *TI_ka1; /* K1 / ka1 upper left of keypad */
357
char *TI_ka3; /* K3 / ka3 upper right of keypad */
358
char *TI_kb2; /* K2 / kb2 center of keypad */
359
char *TI_kc1; /* K4 / kc1 lower left of keypad */
360
char *TI_kc3; /* K5 / kc3 lower right of keypad */
361
char *TI_mc5p; /* pO / mc5p turn on printer for #1 bytes */
362
char *TI_rmp; /* rP / rmp like ip but when in insert mode */
363
char *TI_acsc; /* ac / acsc graphics charset pairs, based on vt100 */
364
char *TI_pln; /* pn / pln program label #1 to show string #2 */
365
char *TI_kcbt; /* kB / kcbt back-tab key */
366
char *TI_smxon; /* SX / smxon turn on xon/xoff handshaking */
367
char *TI_rmxon; /* RX / rmxon turn off xon/xoff handshaking */
368
char *TI_smam; /* SA / smam turn on automatic margins */
369
char *TI_rmam; /* RA / rmam turn off automatic margins */
370
char *TI_xonc; /* XN / xonc XON character */
371
char *TI_xoffc; /* XF / xoffc XOFF character */
372
char *TI_enacs; /* eA / enacs enable alternate char set */
373
char *TI_smln; /* LO / smln turn on soft labels */
374
char *TI_rmln; /* LF / rmln turn off soft labels */
375
char *TI_kbeg; /* @1 / kbeg begin key */
376
char *TI_kcan; /* @2 / kcan cancel key */
377
char *TI_kclo; /* @3 / kclo close key */
378
char *TI_kcmd; /* @4 / kcmd command key */
379
char *TI_kcpy; /* @5 / kcpy copy key */
380
char *TI_kcrt; /* @6 / kcrt create key */
381
char *TI_kend; /* @7 / kend end key */
382
char *TI_kent; /* @8 / kent enter/send key */
383
char *TI_kext; /* @9 / kext exit key */
384
char *TI_kfnd; /* @0 / kfnd find key */
385
char *TI_khlp; /* %1 / khlp help key */
386
char *TI_kmrk; /* %2 / kmrk mark key */
387
char *TI_kmsg; /* %3 / kmsg message key */
388
char *TI_kmov; /* %4 / kmov move key */
389
char *TI_knxt; /* %5 / knxt next key */
390
char *TI_kopn; /* %6 / kopn open key */
391
char *TI_kopt; /* %7 / kopt options key */
392
char *TI_kprv; /* %8 / kprv previous key */
393
char *TI_kprt; /* %9 / kprt print key */
394
char *TI_krdo; /* %0 / krdo redo key */
395
char *TI_kref; /* &1 / kref reference key */
396
char *TI_krfr; /* &2 / krfr refresh key */
397
char *TI_krpl; /* &3 / krpl replace key */
398
char *TI_krst; /* &4 / krst restart key */
399
char *TI_kres; /* &5 / kres resume key */
400
char *TI_ksav; /* &6 / ksav save key */
401
char *TI_kspd; /* &7 / kspd suspend key */
402
char *TI_kund; /* &8 / kund undo key */
403
char *TI_kBEG; /* &9 / kBEG shifted begin key */
404
char *TI_kCAN; /* &0 / kCAN shifted cancel key */
405
char *TI_kCMD; /* *1 / kCMD shifted command key */
406
char *TI_kCPY; /* *2 / kCPY shifted copy key */
407
char *TI_kCRT; /* *3 / kCRT shifted create key */
408
char *TI_kDC; /* *4 / kDC shifted delete-character key */
409
char *TI_kDL; /* *5 / kDL shifted delete-line key */
410
char *TI_kslt; /* *6 / kslt select key */
411
char *TI_kEND; /* *7 / kEND shifted end key */
412
char *TI_kEOL; /* *8 / kEOL shifted clear-to-end-of-line key */
413
char *TI_kEXT; /* *9 / kEXT shifted exit key */
414
char *TI_kFND; /* *0 / kFND shifted find key */
415
char *TI_kHLP; /* #1 / kHLP shifted help key */
416
char *TI_kHOM; /* #2 / kHOM shifted home key */
417
char *TI_kIC; /* #3 / kIC shifted insert-character key */
418
char *TI_kLFT; /* #4 / kLFT shifted left-arrow key */
419
char *TI_kMSG; /* %a / kMSG shifted message key */
420
char *TI_kMOV; /* %b / kMOV shifted move key */
421
char *TI_kNXT; /* %c / kNXT shifted next key */
422
char *TI_kOPT; /* %d / kOPT shifted options key */
423
char *TI_kPRV; /* %e / kPRV shifted previous key */
424
char *TI_kPRT; /* %f / kPRT shifted print key */
425
char *TI_kRDO; /* %g / kRDO shifted redo key */
426
char *TI_kRPL; /* %h / kRPL shifted replace key */
427
char *TI_kRIT; /* %i / kRIT shifted right-arrow key */
428
char *TI_kRES; /* %j / kRES shifted resume key */
429
char *TI_kSAV; /* !1 / kSAV shifted save key */
430
char *TI_kSPD; /* !2 / kSPD shifted suspend key */
431
char *TI_kUND; /* !3 / kUND shifted undo key */
432
char *TI_rfi; /* RF / rfi send next input char (for ptys) */
433
char *TI_kf11; /* F1 / kf11 F11 function key */
434
char *TI_kf12; /* F2 / kf12 F12 function key */
435
char *TI_kf13; /* F3 / kf13 F13 function key */
436
char *TI_kf14; /* F4 / kf14 F14 function key */
437
char *TI_kf15; /* F5 / kf15 F15 function key */
438
char *TI_kf16; /* F6 / kf16 F16 function key */
439
char *TI_kf17; /* F7 / kf17 F17 function key */
440
char *TI_kf18; /* F8 / kf18 F18 function key */
441
char *TI_kf19; /* F9 / kf19 F19 function key */
442
char *TI_kf20; /* FA / kf20 F20 function key */
443
char *TI_kf21; /* FB / kf21 F21 function key */
444
char *TI_kf22; /* FC / kf22 F22 function key */
445
char *TI_kf23; /* FD / kf23 F23 function key */
446
char *TI_kf24; /* FE / kf24 F24 function key */
447
char *TI_kf25; /* FF / kf25 F25 function key */
448
char *TI_kf26; /* FG / kf26 F26 function key */
449
char *TI_kf27; /* FH / kf27 F27 function key */
450
char *TI_kf28; /* FI / kf28 F28 function key */
451
char *TI_kf29; /* FJ / kf29 F29 function key */
452
char *TI_kf30; /* FK / kf30 F30 function key */
453
char *TI_kf31; /* FL / kf31 F31 function key */
454
char *TI_kf32; /* FM / kf32 F32 function key */
455
char *TI_kf33; /* FN / kf33 F33 function key */
456
char *TI_kf34; /* FO / kf34 F34 function key */
457
char *TI_kf35; /* FP / kf35 F35 function key */
458
char *TI_kf36; /* FQ / kf36 F36 function key */
459
char *TI_kf37; /* FR / kf37 F37 function key */
460
char *TI_kf38; /* FS / kf38 F38 function key */
461
char *TI_kf39; /* FT / kf39 F39 function key */
462
char *TI_kf40; /* FU / kf40 F40 function key */
463
char *TI_kf41; /* FV / kf41 F41 function key */
464
char *TI_kf42; /* FW / kf42 F42 function key */
465
char *TI_kf43; /* FX / kf43 F43 function key */
466
char *TI_kf44; /* FY / kf44 F44 function key */
467
char *TI_kf45; /* FZ / kf45 F45 function key */
468
char *TI_kf46; /* Fa / kf46 F46 function key */
469
char *TI_kf47; /* Fb / kf47 F47 function key */
470
char *TI_kf48; /* Fc / kf48 F48 function key */
471
char *TI_kf49; /* Fd / kf49 F49 function key */
472
char *TI_kf50; /* Fe / kf50 F50 function key */
473
char *TI_kf51; /* Ff / kf51 F51 function key */
474
char *TI_kf52; /* Fg / kf52 F52 function key */
475
char *TI_kf53; /* Fh / kf53 F53 function key */
476
char *TI_kf54; /* Fi / kf54 F54 function key */
477
char *TI_kf55; /* Fj / kf55 F55 function key */
478
char *TI_kf56; /* Fk / kf56 F56 function key */
479
char *TI_kf57; /* Fl / kf57 F57 function key */
480
char *TI_kf58; /* Fm / kf58 F58 function key */
481
char *TI_kf59; /* Fn / kf59 F59 function key */
482
char *TI_kf60; /* Fo / kf60 F60 function key */
483
char *TI_kf61; /* Fp / kf61 F61 function key */
484
char *TI_kf62; /* Fq / kf62 F62 function key */
485
char *TI_kf63; /* Fr / kf63 F63 function key */
486
char *TI_el1; /* cb / el1 Clear to beginning of line */
487
char *TI_mgc; /* MC / mgc clear right and left soft margins */
488
char *TI_smgl; /* ML / smgl set left soft margin at current column */
489
char *TI_smgr; /* MR / smgr set right soft margin at current column */
490
char *TI_fln; /* Lf / fln label format */
491
char *TI_sclk; /* SC / sclk set clock, #1 hrs #2 mins #3 secs */
492
char *TI_dclk; /* DK / dclk display clock at (#1,#2) */
493
char *TI_rmclk; /* RC / rmclk remove clock */
494
char *TI_cwin; /* CW / cwin define a window #1 from #2,#3 to #4,#5 */
495
char *TI_wingo; /* WG / wingo go to window #1 */
496
char *TI_hup; /* HU / hup hang-up phone */
497
char *TI_dial; /* DI / dial dial number #1 */
498
char *TI_qdial; /* QD / qdial dial number #1 without checking */
499
char *TI_tone; /* TO / tone select touch tone dialing */
500
char *TI_pulse; /* PU / pulse select pulse dialing */
501
char *TI_hook; /* fh / hook flash switch hook */
502
char *TI_pause; /* PA / pause pause for 2-3 seconds */
503
char *TI_wait; /* WA / wait wait for dial-tone */
504
char *TI_u0; /* u0 / u0 User string #0 */
505
char *TI_u1; /* u1 / u1 User string #1 */
506
char *TI_u2; /* u2 / u2 User string #2 */
507
char *TI_u3; /* u3 / u3 User string #3 */
508
char *TI_u4; /* u4 / u4 User string #4 */
509
char *TI_u5; /* u5 / u5 User string #5 */
510
char *TI_u6; /* u6 / u6 User string #6 */
511
char *TI_u7; /* u7 / u7 User string #7 */
512
char *TI_u8; /* u8 / u8 User string #8 */
513
char *TI_u9; /* u9 / u9 User string #9 */
514
char *TI_op; /* op / op Set default pair to its original value */
515
char *TI_oc; /* oc / oc Set all color pairs to the original ones */
516
char *TI_initc; /* Ic / initc initialize color #1 to (#2,#3,#4) */
517
char *TI_initp; /* Ip / initp Initialize color pair #1 to fg=(#2,#3,#4), bg=(#5,#6,#7) */
518
char *TI_scp; /* sp / scp Set current color pair to #1 */
519
char *TI_setf; /* Sf / setf Set foreground color #1 */
520
char *TI_setb; /* Sb / setb Set background color #1 */
521
char *TI_cpi; /* ZA / cpi Change number of characters per inch */
522
char *TI_lpi; /* ZB / lpi Change number of lines per inch */
523
char *TI_chr; /* ZC / chr Change horizontal resolution */
524
char *TI_cvr; /* ZD / cvr Change vertical resolution */
525
char *TI_defc; /* ZE / defc Define a character */
526
char *TI_swidm; /* ZF / swidm Enter double-wide mode */
527
char *TI_sdrfq; /* ZG / sdrfq Enter draft-quality mode */
528
char *TI_sitm; /* ZH / sitm Enter italic mode */
529
char *TI_slm; /* ZI / slm Start leftward carriage motion */
530
char *TI_smicm; /* ZJ / smicm Start micro-motion mode */
531
char *TI_snlq; /* ZK / snlq Enter NLQ mode */
532
char *TI_snrmq; /* ZL / snrmq Enter normal-quality mode */
533
char *TI_sshm; /* ZM / sshm Enter shadow-print mode */
534
char *TI_ssubm; /* ZN / ssubm Enter subscript mode */
535
char *TI_ssupm; /* ZO / ssupm Enter superscript mode */
536
char *TI_sum; /* ZP / sum Start upward carriage motion */
537
char *TI_rwidm; /* ZQ / rwidm End double-wide mode */
538
char *TI_ritm; /* ZR / ritm End italic mode */
539
char *TI_rlm; /* ZS / rlm End left-motion mode */
540
char *TI_rmicm; /* ZT / rmicm End micro-motion mode */
541
char *TI_rshm; /* ZU / rshm End shadow-print mode */
542
char *TI_rsubm; /* ZV / rsubm End subscript mode */
543
char *TI_rsupm; /* ZW / rsupm End superscript mode */
544
char *TI_rum; /* ZX / rum End reverse character motion */
545
char *TI_mhpa; /* ZY / mhpa Like column_address in micro mode */
546
char *TI_mcud1; /* ZZ / mcud1 Like cursor_down in micro mode */
547
char *TI_mcub1; /* Za / mcub1 Like cursor_left in micro mode */
548
char *TI_mcuf1; /* Zb / mcuf1 Like cursor_right in micro mode */
549
char *TI_mvpa; /* Zc / mvpa Like row_address in micro mode */
550
char *TI_mcuu1; /* Zd / mcuu1 Like cursor_up in micro mode */
551
char *TI_porder; /* Ze / porder Match software bits to print-head pins */
552
char *TI_mcud; /* Zf / mcud Like parm_down_cursor in micro mode */
553
char *TI_mcub; /* Zg / mcub Like parm_left_cursor in micro mode */
554
char *TI_mcuf; /* Zh / mcuf Like parm_right_cursor in micro mode */
555
char *TI_mcuu; /* Zi / mcuu Like parm_up_cursor in micro mode */
556
char *TI_scs; /* Zj / scs Select character set */
557
char *TI_smgb; /* Zk / smgb Set bottom margin at current line */
558
char *TI_smgbp; /* Zl / smgbp Set bottom margin at line #1 or #2 lines from bottom */
559
char *TI_smglp; /* Zm / smglp Set left (right) margin at column #1 (#2) */
560
char *TI_smgrp; /* Zn / smgrp Set right margin at column #1 */
561
char *TI_smgt; /* Zo / smgt Set top margin at current line */
562
char *TI_smgtp; /* Zp / smgtp Set top (bottom) margin at row #1 (#2) */
563
char *TI_sbim; /* Zq / sbim Start printing bit image graphics */
564
char *TI_scsd; /* Zr / scsd Start character set definition */
565
char *TI_rbim; /* Zs / rbim Stop printing bit image graphics */
566
char *TI_rcsd; /* Zt / rcsd End definition of character set */
567
char *TI_subcs; /* Zu / subcs List of subscriptable characters */
568
char *TI_supcs; /* Zv / supcs List of superscriptable characters */
569
char *TI_docr; /* Zw / docr Printing any of these characters causes CR */
570
char *TI_zerom; /* Zx / zerom No motion for subsequent character */
571
char *TI_csnm; /* Zy / csnm List of character set names */
572
char *TI_kmous; /* Km / kmous Mouse event has occurred */
573
char *TI_minfo; /* Mi / minfo Mouse status information */
574
char *TI_reqmp; /* RQ / reqmp Request mouse position */
575
char *TI_getm; /* Gm / getm Curses should get button events */
576
char *TI_setaf; /* AF / setaf Set foreground color using ANSI escape */
577
char *TI_setab; /* AB / setab Set background color using ANSI escape */
578
char *TI_pfxl; /* xl / pfxl Program function key #1 to type string #2 and show string #3 */
579
char *TI_devt; /* dv / devt Indicate language/codeset support */
580
char *TI_csin; /* ci / csin Init sequence for multiple codesets */
581
char *TI_s0ds; /* s0 / s0ds Shift to code set 0 (EUC set 0, ASCII) */
582
char *TI_s1ds; /* s1 / s1ds Shift to code set 1 */
583
char *TI_s2ds; /* s2 / s2ds Shift to code set 2 */
584
char *TI_s3ds; /* s3 / s3ds Shift to code set 3 */
585
char *TI_smglr; /* ML / smglr Set both left and right margins to #1, #2 */
586
char *TI_smgtb; /* MT / smgtb Sets both top and bottom margins to #1, #2 */
587
char *TI_birep; /* Xy / birep Repeat bit image cell #1 #2 times */
588
char *TI_binel; /* Zz / binel Move to next row of the bit image */
589
char *TI_bicr; /* Yv / bicr Move to beginning of same row */
590
char *TI_colornm; /* Yw / colornm Give name for color #1 */
591
char *TI_defbi; /* Yx / defbi Define rectangualar bit image region */
592
char *TI_endbi; /* Yy / endbi End a bit-image region */
593
char *TI_setcolor; /* Yz / setcolor Change to ribbon color #1 */
594
char *TI_slines; /* YZ / slines Set page length to #1 lines */
595
char *TI_dispc; /* S1 / dispc Display PC character */
596
char *TI_smpch; /* S2 / smpch Enter PC character display mode */
597
char *TI_rmpch; /* S3 / rmpch Exit PC character display mode */
598
char *TI_smsc; /* S4 / smsc Enter PC scancode mode */
599
char *TI_rmsc; /* S5 / rmsc Exit PC scancode mode */
600
char *TI_pctrm; /* S6 / pctrm PC terminal options */
601
char *TI_scesc; /* S7 / scesc Escape for scancode emulation */
602
char *TI_scesa; /* S8 / scesa Alternate escape for scancode emulation */
603
char *TI_ehhlm; /* Xh / ehhlm Enter horizontal highlight mode */
604
char *TI_elhlm; /* Xl / elhlm Enter left highlight mode */
605
char *TI_elohlm; /* Xo / elohlm Enter low highlight mode */
606
char *TI_erhlm; /* Xr / erhlm Enter right highlight mode */
607
char *TI_ethlm; /* Xt / ethlm Enter top highlight mode */
608
char *TI_evhlm; /* Xv / evhlm Enter vertical highlight mode */
609
char *TI_sgr1; /* sA / sgr1 Define second set of video attributes #1-#6 */
610
char *TI_slength; /* sL / slength YI Set page length to #1 hundredth of an inch */
611
char *TI_OTi2; /* i2 / OTi2 secondary initialization string */
612
char *TI_OTrs; /* rs / OTrs terminal reset string */
613
int TI_OTug; /* ug / OTug number of blanks left by ul */
614
int TI_OTbs; /* bs / OTbs uses ^H to move left */
615
int TI_OTns; /* ns / OTns crt cannot scroll */
616
int TI_OTnc; /* nc / OTnc no way to go to start of line */
617
int TI_OTdC; /* dC / OTdC pad needed for CR */
618
int TI_OTdN; /* dN / OTdN pad needed for LF */
619
char *TI_OTnl; /* nl / OTnl use to move down */
620
char *TI_OTbc; /* bc / OTbc move left, if not ^H */
621
int TI_OTMT; /* MT / OTMT has meta key */
622
int TI_OTNL; /* NL / OTNL move down with \n */
623
int TI_OTdB; /* dB / OTdB padding required for ^H */
624
int TI_OTdT; /* dT / OTdT padding required for ^I */
625
int TI_OTkn; /* kn / OTkn count of function keys */
626
char *TI_OTko; /* ko / OTko list of self-mapped keycaps */
627
char *TI_OTma; /* ma / OTma map arrow keys rogue(1) motion keys */
628
int TI_OTpt; /* pt / OTpt has 8-char tabs invoked with ^I */
629
int TI_OTxr; /* xr / OTxr return clears the line */
630
char *TI_OTG2; /* G2 / OTG2 single upper left */
631
char *TI_OTG3; /* G3 / OTG3 single lower left */
632
char *TI_OTG1; /* G1 / OTG1 single upper right */
633
char *TI_OTG4; /* G4 / OTG4 single lower right */
634
char *TI_OTGR; /* GR / OTGR tee pointing right */
635
char *TI_OTGL; /* GL / OTGL tee pointing left */
636
char *TI_OTGU; /* GU / OTGU tee pointing up */
637
char *TI_OTGD; /* GD / OTGD tee pointing down */
638
char *TI_OTGH; /* GH / OTGH single horizontal line */
639
char *TI_OTGV; /* GV / OTGV single vertical line */
640
char *TI_OTGC; /* GC / OTGC single intersection */
641
char *TI_meml; /* ml / meml memory lock above */
642
char *TI_memu; /* mu / memu memory unlock */
643
char *TI_box1; /* bx / box1 box characters primary set */
644
/* non termcap/terminfo terminal info (generated by epic) */
645
char TI_normal[256];
646
char *TI_sgrstrs[TERM_SGR_MAXVAL];
647
char *TI_forecolors[16];
648
char *TI_backcolors[16];
649
int TI_meta_mode;
650
/* int TI_need_redraw ; */
651
};
652
653
extern struct term_struct *current_term;
654
655
#define term_has(x) (termfeatures & (x))
656
#define capstr(x) (current_term->TI_sgrstrs[(TERM_SGR_ ## x)-1])
657
#define outcap(x) (tputs_x(capstr(x)))
658
659
#ifndef TERM_DEBUG
660
#define tputs_x(s) (tputs(s, 0, putchar_x))
661
#else
662
int tputs_x(char *);
663
#endif
664
#if 0
665
#define term_underline_on() outcap(UNDL_ON)
666
#define term_underline_off() outcap(UNDL_OFF)
667
#define term_standout_on() outcap(REV_ON)
668
#define term_standout_off() outcap(REV_OFF)
669
#define term_blink_on() outcap(BLINK_ON)
670
#define term_blink_off() outcap(BLINK_OFF)
671
#define term_bold_on() outcap(BOLD_ON)
672
#define term_bold_off() outcap(BOLD_OFF)
673
#define term_altcharset_on() outcap(ALTCHAR_ON)
674
#define term_altcharset_off() outcap(ALTCHAR_OFF)
675
#endif
676
#define term_underline_on() if (get_int_var(UNDERLINE_VIDEO_VAR)) \
677
outcap(UNDL_ON)
678
#define term_underline_off() if (get_int_var(UNDERLINE_VIDEO_VAR)) \
679
outcap(UNDL_OFF)
680
#define term_standout_on() if (get_int_var(INVERSE_VIDEO_VAR)) \
681
outcap(REV_ON)
682
#define term_standout_off() if (get_int_var(INVERSE_VIDEO_VAR)) \
683
outcap(REV_OFF)
684
#define term_blink_on() if (get_int_var(BLINK_VIDEO_VAR)) \
685
outcap(BLINK_ON)
686
#define term_blink_off() if (get_int_var(BLINK_VIDEO_VAR)) \
687
outcap(BLINK_OFF)
688
#define term_bold_on() if (get_int_var(BOLD_VIDEO_VAR)) \
689
outcap(BOLD_ON)
690
#define term_bold_off() if (get_int_var(BOLD_VIDEO_VAR)) \
691
outcap(BOLD_OFF)
692
#define term_altcharset_on() if (get_int_var(ALT_CHARSET_VAR)) \
693
outcap(ALTCHAR_ON)
694
#define term_altcharset_off() if (get_int_var(ALT_CHARSET_VAR)) \
695
outcap(ALTCHAR_OFF)
696
697
#define term_set_foreground(x) tputs_x(current_term->TI_forecolors[(x) & 0x0f])
698
#define term_set_background(x) tputs_x(current_term->TI_backcolors[(x) & 0x0f])
699
#define term_set_attribs(f,b) tputs_x(term_getsgr(TERM_SGR_COLORS,(f),(b)))
700
#define term_putgchar(x) tputs_x(term_getsgr(TERM_SGR_GCHAR,(x),0))
701
#define term_move_cursor(c, r) term_gotoxy((c),(r))
702
#define term_cr() tputs_x(current_term->TI_cr)
703
#define term_newline() tputs_x(current_term->TI_nel)
704
#define term_cursor_left() term_left(1)
705
#define term_cursor_right() term_right(1)
706
#define term_clear_to_eol() term_clreol()
707
#define term_clear_screen() term_clrscr()
708
709
#ifdef __EMX__
710
extern int vio_screen;
711
extern char default_pair[2];
712
#endif
713
#endif
714
715
RETSIGTYPE term_cont (int);
716
void term_beep (void);
717
int term_echo (int);
718
int term_init (char *);
719
int term_resize (void);
720
void term_pause (char, char *);
721
void term_putchar (unsigned char);
722
void term_scroll (int, int, int);
723
void term_insert (unsigned char);
724
void term_delete (int);
725
void term_repeat (unsigned char, int);
726
void term_right (int);
727
void term_left (int);
728
void term_clreol (void);
729
void term_clrscr (void);
730
void term_gotoxy (int, int);
731
void term_reset (void);
732
int term_eight_bit (void);
733
void set_term_eight_bit (int);
734
void set_meta_8bit (Window *, char *, int);
735
char * term_getsgr (int, int, int);
736
void reinit_term (int);
737
void term_reset2 (void);
738
void reset_cols (int);
739
void reset_lines (int);
740
char * term_getsgr (int, int, int);
741
char * get_term_capability (char *, int, int);
742
743
#if 0
744
#ifndef TPUTS_DECLARED
745
int tputs (const unsigned char *, int, int (*)(int));
746
#endif
747
#endif
748
749
#endif /* _TERM_H_ */
750
751