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