/* Copyright (C) Magna Carta Software, Inc. 1990, 1991. All Rights Reserved C COMMUNICATIONS TOOLKIT TERMINAL.H -- Common terminal include file. */ #if !defined(TERMINAL_H_INCLUDED) #define TERMINAL_H_INCLUDED #if !defined(CCTDEF_H_INCLUDED) #include /* constant definitions */ #endif #if !defined(CCTTYPE_H_INCLUDED) #include /* type definitions */ #endif #define TTY 0 #define ANSI_SYS 1 #define ANSI_X364 2 #define DEC_VT52 3 #define DEC_VT100 4 #define DEC_VT220 5 #define DEC_VT320 6 #define ALTOSIII 7 #define TV_910 8 #define TV_912 9 #define TV_925 10 /* CONFIGURABLE TERMINAL PARAMETERS */ #define TERM_COLORS 0 #define TERM_COLS 1 #define TERM_KEYCLICK 2 #define TERM_ROWS 3 #define ATT(fg, bg) (((bg) << 4) | (fg)) #define CATT(ch, att) (((att) << 8) | (ch)) #define BG(a) ((a) >> 4) #define FG(a) ((a) & 0XF) #define SCAN(a) ((a) >> 8) #define CURSIZE(top, bot) (((top) << 8) | bot) #define isekk(a) (((a) & 0XFF) == 0XE0) #define MAX_ESC_LEN 32 /* max. permitted esc. sequence len */ #define MAX_PARM_LEN 20 /* max. permitted parm. length */ #define MAX_TERM_PARMS 24 /* max. permitted # of parms. */ #define TERM_MAX_COLS 132 /* max. permitted no. of columns */ #define MAX_TERM_KEYS 256+12 /* maximum definable keys */ #define MAX_SHIFT_STATES 4 /* maximum number of shift states */ #define MAX_CMD_LEN 16 /* max. len. of a string command */ #define MAX_TERM_CMDS 100 /* maximum number of terminal cmds. */ #define KEYCLICK 8 /* ORed with t->mode if keys click */ #define ANSI_LNM 2 /* CR => CR/LF */ #define ANSI_PRN_CTRL 4 /* printer controller on */ #define PRN_CTRL 4 /* printer controller mode */ /* MANIFEST CONSTANTS FOR HOST AND TERMINAL COMMANDS */ #define TERM_TYPE 0 /* type of terminal (e.g. VT-100) */ /* #define CSI 1 */ /* Command sequence introducer */ /* *** TERMINAL TO HOST *** */ #define FIND 0 /* Find */ #define INSERT_HERE 1 /* Insert here */ #define REMOVE 2 /* Remove */ #define SELECT 3 /* Select */ #define PREV_SCREEN 4 /* Prev Screen */ #define NEXT_SCREEN 5 /* Next Screen */ /* FUNCTION KEYS */ #define PF1 24 /* Programmable function key 1 */ #define PF2 25 /* Programmable function key 2 */ #define PF3 26 /* Programmable function key 3 */ #define PF4 27 /* Programmable function key 4 */ #define PF5 28 /* Programmable function key 5 */ #define PF6 29 /* Programmable function key 6 */ #define PF7 30 /* Programmable function key 7 */ #define PF8 31 /* Programmable function key 8 */ #define PF9 32 /* Programmable function key 9 */ #define PF10 33 /* Programmable function key 10 */ #define PF11 34 /* Programmable function key 11 */ #define PF12 35 /* Programmable function key 12 */ #define PF13 36 /* Programmable function key 13 */ #define PF14 37 /* Programmable function key 14 */ #define PF15 38 /* Programmable function key 15 */ #define PF16 39 /* Programmable function key 16 */ #define PF17 40 /* Programmable function key 17 */ #define PF18 41 /* Programmable function key 18 */ #define PF19 42 /* Programmable function key 19 */ #define PF20 43 /* Programmable function key 20 */ #define K_BREAK 44 /* Break */ /* *** HOST TO TERMINAL *** */ #define LEVEL 1 /* Set terminal level */ #define BELL 2 /* Generate bell tone (if bell enabled) */ /* ANSI COMMANDS */ /* TERMINAL MODES -- (boolean) set / reset */ #define RIS 1 /* reset to initial state */ #define LNM 20 /* line feed/new line mode */ #define RM 3 /* reset mode */ #define SM 4 /* set mode */ /* CURSOR ATTRIBUTES */ #define CA 5 /* set cursor attributes */ /* CURSOR POSITIONING */ #define CUU 10 /* cursor up */ #define CUD 11 /* cursor down */ #define CUF 12 /* cursor forward */ #define CUB 13 /* cursor back */ #define CUP 14 /* cursor position */ #define HVP 15 /* cursor horizontal and vertical pos. */ #define IND 16 /* index */ #define TRI 17 /* reverse index (RI already assigned) */ #define NEL 18 /* next line */ /* TAB STOPS */ #define HTS 2 /* horizontal tab set */ #define TBC 21 /* clear tab(s) */ /* CHARACTER ATTRIBUTES */ #define SGR 22 /* set graphics rendition */ #define SCA 23 /* select character attributes */ #define SCS 24 /* select character set */ #define SPM 25 /* set protect mode (TV9xx series) */ #define RPM 26 /* reset protect mode (TV9xx series) */ /* ERASING */ #define ECH 45 /* erase character */ #define EBD 46 /* erase from beg. of display to cursor */ #define ED 47 /* erase display */ #define EED0 48 /* erase to end of display */ #define EED1 49 /* erase to end of display */ #define EBL 50 /* erase from beg. of line to cursor */ #define EEL0 51 /* erase from cursor to end of line */ #define EEL1 52 /* erase from cursor to end of line */ #define EL 53 /* erase line */ /* LINE ATTRIBUTES */ #define SINGLE_HEIGHT 36 /* select single-height characters */ #define DOUBLE_HEIGHT 37 /* select double-height characters */ #define SINGLE_WIDTH 38 /* select single-width characters */ #define DOUBLE_WIDTH 39 /* select double-width characters */ /* EDITING */ #define IL 40 /* insert lines at cursor */ #define DL 41 /* delete lines at cursor */ #define ICH 42 /* ins char(s) at cursor */ #define DEL_CHAR 43 /* del char(s) at cursor */ /* ERASING */ #define EEBD 51 /* erase erasables from beg. of display to cur. */ #define EEBL 52 /* erase erasables from BOL to cursor */ #define EEED 53 /* erase erasable chars in line */ #define EEEL 54 /* erase erasable from cursor to EOD */ #define EEIL 55 /* erase erasable from BOD to cursor */ /* TOP AND BOTTOM MARGINS */ #define SET_MARGINS 57 /* set top and bottom margins */ /* PRINTING */ #define MEDIA_COPY 58 /* printer commands */ /* USER-DEFINED KEYS */ #define DEFINE_KEY 64 /* define terminal key */ /* REPORTS */ #define DA 65 /* device attributes request */ #define PRI_DA_RESP 66 /* primary device attributes response */ #define SEC_DA_REQ 67 /* secondary device attributes request */ #define SEC_DA_RESP 68 /* secondary device attributes response */ /* DEVICE STATUS REPORT */ #define TERMID 70 #define TDSR 71 /* device status report (DSR already assigned) */ #define CPR 72 /* host: cursor pos. report request */ /* DSR -- PRINTER PORT */ #define PRN_STATUS_REQ 73 /* host: request printer status */ #define PRN_STATUS_RESP 74 /* term: printer status */ /* USER DEFINABLE KEYS */ #define KEYS_STATUS_REQ 75 /* host: request UDKs status */ #define KEYS_STATUS_RESP 76 /* term: UDKs status */ #define SAVE_CURSOR 30 /* save cursor, wrap flag, origin mode, etc. */ #define REST_CURSOR 31 /* save cursor, wrap flag, origin mode, etc. */ #define MODE_DECANM 80 /* ANSI/VT52 */ #define MODE_DECARM 81 /* DEC auto-repeat mode */ #define MODE_DECAWM 82 /* DEC auto-wrap mode */ #define MODE_DECCKM 83 /* DEC cursor key mode */ #define MODE_DECCOLM 84 /* DEC column mode */ #define MODE_DECINLM 85 /* DEC interlace mode */ #define MODE_DECKPAM 86 /* DEC keypad application mode */ #define MODE_DECKPNM 87 /* DEC keypad numeric mode */ #define MODE_DECOM 88 /* DEC origin */ #define MODE_DECRC 89 /* DEC restore cursor */ #define MODE_DECSC 90 /* DEC save cursor */ #define MODE_DECSCL 91 /* DEC compatibility level */ #define MODE_DECSCLM 92 /* DEC scrolling mode */ #define MODE_DECSCNM 93 /* DEC screen mode */ #define MODE_DECSTBM 94 /* DEC set top & bottom margins */ #define MODE_DECSWL 95 /* DEC single width line */ /* ALIAS */ #define USER1 95 /* extra command 1 */ #define USER2 96 /* extra command 2 */ #define USER3 97 /* extra command 3 */ #define USER4 98 /* extra command 4 */ #define USER5 99 /* extra command 5 */ #endif short FCALL_ init_term(struct comm_port *p, TERMINAL *t, void (*v)(void), void (*video)(TERMINAL *t)); short FCALL_ term_ascii_parse_parms_(TERMINAL *t, short *num); short FCALL_ term_assign_cmd(TERMINAL *t, short cmd, const char *sh2t, void (*func)(TERMINAL *, short), const char *st2h); short FCALL_ term_assign_key(TERMINAL *t, WORD key, WORD shift, const char *cmd); short FCALL_ term_binary_parse_parms_(TERMINAL *t, short *num); short FCALL_ term_find_next_tab_stop(TERMINAL *t); short FCALL_ term_print_line_(TERMINAL *t); short FCALL_ term_set(TERMINAL *t, short parm, long val); short FCALL_ term_write(TERMINAL *t, WORD ch); #if 0 short FCALL_ strfind_(TERMINAL *t, const char *n); short FCALL_ term_c_puts(TERMINAL *t, const char *s); short FCALL_ term_c_write(struct comm_port *p, WORD ch); short FCALL_ term_conoutc_(struct comm_port *p, short ch); short FCALL_ term_parse_(TERMINAL *t, short ch); void FCALL_ term_set_tabs_(TERMINAL *t, WORD pos, WORD state); #endif #if 0 #define MODE_KBD_ACTION 3 /* Lock/Unlock */ #define MODE_INS_REP 4 /* Insert/Replace */ #define MODE_SEND_RECEIVE 5 /* Send/Receive */ #define MODE_LFNL 6 /* New Line/Line Feed */ #define MODE_CUR_KEY 7 /* Application /Cursor */ #define MODE_ANSI_OFF 9 /* ANSI/VT52 */ #define MODE_COLS 10 /* 132 column /80 column */ #define MODE_SCROLLING 11 /* smooth/jump */ #define MODE_SCREEN 12 /* reverse/normal */ #define MODE_AUTO_WRAP 13 /* on/off */ #define MODE_AUTO_REPEAT 14 /* on/off */ #define MODE_PRINT_FF 15 /* print form feed on/off */ #define MODE_PRINT_EXTENT 16 /* full screen/scrolling region */ #define MODE_KEYPAD_ON 17 /* application/numeric */ #define MODE_KEYPAD_OFF 18 /* application/numeric */ #define MODE_CHAR_SET 19 /* National/Multinational */ /* CURSOR KEYS */ #define K_CUR_UP 6 /* Up arrow */ #define K_CUR_DOWN 7 /* Down arrow */ #define K_CUR_FO 8 /* Right arrow */ #define K_CUR_BA 9 /* Left arrow */ /* AUXILLIARY KEYPAD KEYS */ #define KPD_ZERO 10 /* Keypad '0' */ #define KPD_ONE 11 /* Keypad '1' */ #define KPD_TWO 12 /* Keypad '2' */ #define KPD_THREE 13 /* Keypad '3' */ #define KPD_FOUR 14 /* Keypad '4' */ #define KPD_FIVE 15 /* Keypad '5' */ #define KPD_SIX 16 /* Keypad '6' */ #define KPD_SEVEN 17 /* Keypad '7' */ #define KPD_EIGHT 18 /* Keypad '8' */ #define KPD_NINE 19 /* Keypad '9' */ #define KPD_MINUS 20 /* Keypad '-' */ #define KPD_COMMA 21 /* Keypad ',' */ #define KPD_PERIOD 22 /* Keypad '.' */ #define KPD_ENTER 23 /* Keypad ENTER */ #endif