/*
	DECCRT.H

	Digital Equipment VT Series Screen Control Macros
	8 bit Multinational Character Set (in OCTAL)
	Thomas C. Gray
*/

#define NULL	000
#define SOH	001
#define STX	002
#define ETX	003
#define EOT	004
#define ENQ	005
#define ACK	006
#define BELL	007
#define BS	010
#define HT	011
#define LF	012
#define VT	013
#define FF	014
#define CR	015
#define SO	016
#define SI	017
#define DLE	020
#define XON	021
#define DC1	021
#define DC2	022
#define XOFF	023
#define DC3	023
#define DC4	024
#define NAK	025
#define SYN	026
#define ETB	027
#define CAN	030
#define EX	031
#define SUB	032
#define ESC	033
#define FS	034
#define GS	035
#define RS	036
#define US	037
#define DEL	177

	/** OCTAL numbers not in sequence are reserved to Digital as of **/
	/** March 19, 1984 **/

#define INVERTED_EXCL_MARK	0241
#define CENT_SIGN		0242
#define POUND_SIGN		0243
#define YEN_SIGN		0245
#define SECTION_SIGN		0247
#define CURRENCY_SIGN		0250
#define COPYRIGHT_SIGN		0251
#define FEMININE_ORDINAL_SIGN	0252
#define ANGLE_QUOTE_MARK_LEFT	0253
#define DEGREE_SIGN		0260
#define PLUS_MINUS_SIGN		0261
#define SUPERSCRIPT_2		0262
#define SUPERSCRIPT_3		0263
#define MICRO_SIGN		0265
#define PARAGRAPH_SIGN		0266
#define MIDDLE_DOT		0267
#define SUPERSCRIPT_1		0271
#define MASCULINE_ORDINAL_SIGN	0272
#define ANGLE_QUOTE_MARK_RIGHT	0273
#define FRACTION_ONE_QUARTER	0274
#define FRACTION_ONE_HALF	0275
#define INVERTED_QUES_MARK	0277

#define CAPITAL_A_GRAVE_ACCENT	0300
#define CAPITAL_A_ACCUTE_ACCENT	0301
#define CAPITAL_A_CIRCUMFLEX	0302
#define CAPITAL_A_TILDE		0303
#define CAPITAL_A_UMLAUT	0304
#define CAPITAL_A_RING		0305
#define CAPITAL_AE_DIPTHONG	0306
#define CAPITAL_C_CEDILLA	0307
#define CAPITAL_E_GRAVE_ACCENT	0310
#define CAPITAL_E_ACCUTE_ACCENT	0311
#define CAPITAL_E_CIRCUMFLEX	0312
#define CAPITAL_E_UMLAUT	0313
#define CAPITAL_I_GRAVE_ACCENT	0314
#define CAPITAL_I_ACCUTE_ACCENT	0315
#define CAPITAL_I_CIRCUMFLEX	0316
#define CAPITAL_I_UMLAUT	0317
#define CAPITAL_N_TILDE		0321
#define CAPITAL_O_GRAVE_ACCENT	0322
#define CAPITAL_O_ACCUTE_ACCENT	0323
#define CAPITAL_O_CIRCUMFLEX	0324
#define CAPITAL_O_TILDE		0325
#define CAPITAL_O_UMLAUT	0326
#define CAPITAL_OE_LIGATURE	0327
#define CAPITAL_O_SLASH		0330
#define CAPITAL_U_GRAVE_ACCENT	0331
#define CAPITAL_U_ACCUTE_ACCENT	0332
#define CAPITAL_U_CIRCUMFLEX	0333
#define CAPITAL_U_UMLAUT	0334
#define CAPITAL_Y_UMLAUT	0335
#define GERMAN_SMALL_SHARP_S	0337

#define SMALL_A_GRAVE_ACCENT	0340
#define SMALL_A_ACCUTE_ACCENT	0341
#define SMALL_A_CIRCUMFLEX	0342
#define SMALL_A_TILDE		0343
#define SMALL_A_UMLAUT		0344
#define SMALL_A_RING		0345
#define SMALL_AE_DIPTHONG	0346
#define SMALL_C_CEDILLA		0347
#define SMALL_E_GRAVE_ACCENT	0350
#define SMALL_E_ACCUTE_ACCENT	0351
#define SMALL_E_CIRCUMFLEX	0352
#define SMALL_E_UMLAUT		0353
#define SMALL_I_GRAVE_ACCENT	0354
#define SMALL_I_ACCUTE_ACCENT	0355
#define SMALL_I_CIRCUMFLEX	0356
#define SMALL_I_UMLAUT		0357
#define SMALL_N_TILDE		0361
#define SMALL_O_GRAVE_ACCENT	0362
#define SMALL_O_ACCUTE_ACCENT	0363
#define SMALL_O_CIRCUMFLEX	0364
#define SMALL_O_TILDE		0365
#define SMALL_O_UMLAUT		0366
#define SMALL_OE_LIGATURE	0367
#define SMALL_O_SLASH		0370
#define SMALL_U_GRAVE_ACCENT	0371
#define SMALL_U_ACCUTE_ACCENT	0372
#define SMALL_U_CIRCUMFLEX	0373
#define SMALL_U_UMLAUT		0374
#define SMALL_Y_UMLAUT		0375

	/* Screen Macros */

#define clear()				printf("%c[2J%c[f",ESC,ESC)
#define pos( row,col )			printf("%c[%d;%df",ESC,row,col)
#define bold()				printf("%c[1m",ESC)
#define bold$				"\033[1m"
#define underline()			printf("%c[4m",ESC)
#define blink()				printf("%c[5m",ESC)
#define reverse()			printf("%c[7m",ESC)
#define norm()				printf("%c[0m",ESC)
#define norm$				"\033[0m"
#define wide()				printf("%c#6",ESC)
#define graph_mode()			printf("%c(0",ESC)
#define text_mode()			printf("%c(B",ESC)
#define app_keypad()			printf("%c=",ESC)
#define num_keypad()			printf("%c>",ESC)
#define erase_eol()			printf("%c[0K",ESC)
#define scroll_region( top,bot ) 	printf("%c[%d;%dr",ESC,top,bot)

#define tab()				putchar( '\t' )
#define space()				putchar( ' ' )
#define new_line()			putchar( '\n' )
#define line()				graph_mode(); putchar( VERT_CHAR ); text_mode()

	/* ANSI-lingo Screen Macros (non-dynamic parameters) */

#define CUB( n )			printf("%c[%dD",ESC,n)
#define CUD( n )			printf("%c[%dB",ESC,n)
#define CUF( n )			printf("%c[%dC",ESC,n)
#define CUP( row,col )			printf("%c[%d;%dH",ESC,row,col)
#define CUU( n )			printf("%c[%dA",ESC,n)
#define DA()				printf("%c[c",ESC)
#define DECALN()			printf("%c#8",ESC)
#define DECDHL_TOP()			printf("%c#3",ESC)
#define DECDHL_BOT()			printf("%c#4",ESC)
#define DECDWL()			printf("%c#6",ESC)
#define DECID()				printf("%cZ",ESC)
#define DECKPAM()			printf("%c=",ESC)
#define DECKPNM()			printf("%c>",ESC)
#define DECLL( n )			printf("%c[%dq",ESC,n)
#define DECRC()				printf("%c8",ESC)
#define DECSC()				printf("%c7",ESC)
#define DECSTBM( top,bot )		printf("%c[%d%dr",ESC,top,bot)
#define DECSWL()			printf("%c#5",ESC)
#define DECTST( n )			printf("%c[2;%dy",ESC,n)
#define DSR( n )			printf("%c[%dn",ESC,n")
#define ED( n )				printf("%c[%dJ",ESC,n)
#define EL( n )				printf("%c[%dK",ESC,n)
#define HTS()				printf("%cH",ESC)
#define HVP( row,col )			printf("%c[%d;%df",ESC,row,col)
#define IND()				printf("%cD",ESC)
#define NEL()				printf("%cE",ESC)
#define RI()				printf("%cM",ESC)
#define RIS()				printf("%cc",ESC)
#define SCS_G0_UK_SET()			printf("%c(A",ESC)
#define SCS_G0_ASCII_SET()		printf("%c(B",ESC)
#define SCS_G0_GRAPHICS_SET()		printf("%c(0",ESC)
#define SCS_G0_STANDARD_ROM()		printf("%c(1",ESC)
#define SCS_G0_GRAPHICS_ROM()		printf("%c(2",ESC)
#define SCS_G1_UK_SET()			printf("%c)A",ESC)
#define SCS_G1_ASCII_SET()		printf("%c)B",ESC)
#define SCS_G1_GRAPHICS_SET()		printf("%c)0",ESC)
#define SCS_G1_STANDARD_ROM()		printf("%c)1",ESC)
#define SCS_G1_GRAPHICS_ROM()		printf("%c)2",ESC)
#define SGR( n )			printf("%c[%dm",ESC)
#define TBC( n )			printf("%c[%dg",ESC)

	/* Graphics Mode */

#define GM_BLANK		137		/* Blank space */
#define GM_DIAMOND		140
#define GM_CHECKERBOARD		141
#define GM_HORIZONTAL_TAB	142
#define GM_FORM_FEED		143
#define GM_CARRIAGE_RETURN	144
#define GM_LINE_FEED		145
#define GM_DEGREE_SYMBOL	146
#define GM_PLUS_MINUS_SIGN	147
#define GM_NEW_LINE		150
#define GM_VERTICAL_TAB		151
#define GM_LOWER_RIGHT_CORNER	152
#define GM_UPPER_RIGHT_CORNER	153
#define GM_UPPER_LEFT_CORNER	154
#define GM_LOWER_LEFT_CORNER	155
#define GM_CROSSING_LINES	156
#define GM_HORIZONTAL_SCAN1	157
#define GM_HORIZONTAL_SCAN3	160
#define GM_HORIZONTAL_SCAN5	161
#define GM_HORIZONTAL_SCAN7	162
#define GM_HORIZONTAL_SCAN9	163
#define GM_LEFT_T		164
#define GM_RIGHT_T		165
#define GM_BOTTOM_T		166
#define GM_TOP_T		167
#define GM_VERTICAL_BAR		170
#define GM_LEQ			171
#define GM_GEQ			172
#define GM_PI			173
#define GM_NEQ			174
#define GM_POUND_SIGN		175
#define GM_CENTERED_DOT		176

#define HORZ_CHAR	'q'		/* horizontal bar */
#define VERT_CHAR	'x'		/* vertical bar */
#define ULC_CHAR	'l'		/* upper left corner */
#define URC_CHAR	'k'		/* upper right corner */
#define LLC_CHAR	'm'		/* lower left corner */
#define LRC_CHAR	'j'		/* lower right corner */

#define PF1		"OP"
#define PF2		"OQ"
#define PF3		"OR"
#define PF4		"OS"
#define KP_0		"Op"
#define KP_1		"Oq"
#define KP_2		"Or"
#define KP_3		"Os"
#define KP_4		"Ot"
#define KP_5		"Ou"
#define KP_6		"Ov"
#define KP_7		"Ow"
#define KP_8		"Ox"
#define KP_9		"Oy"
#define KP_ENTER	"OM"
#define KP_PERIOD	"On"
#define KP_COMMA	"Ol"
#define KP_MINUS	"Om"

#define UP_ARROW	"[A"
#define DOWN_ARROW	"[B"
#define RIGHT_ARROW	"[C"
#define LEFT_ARROW	"[D"

#define FIND		"[1~"
#define INSERT_HERE	"[2~"
#define REMOVE		"[3~"
#define SELECT		"[4~"
#define PREV_SCREEN	"[5~"
#define NEXT_SCREEN	"[6~"
#define COMPOSE		"[10~"
#define INTERRUPT	"[17~"
#define RESUME		"[18~"
#define CANCEL		"[19~"
#define MAIN_SCREEN	"[20~"
#define EXIT		"[21~"
#define HELP		"[28~"
#define DO		"[29~"
#define F4		"[14~"
#define F17		"[31~"
#define F18		"[32~"
#define F19		"[33~"
#define F20		"[34~"
