%external %routine %spec set up terminal %alias "IE_SET_UP_TERMINAL"
%external %routine %spec reset terminal  %alias "IE_RESET_TERMINAL"
%external %integer %function %spec Default Terminal %alias "IE_DEF_TER"
%external %byte %spec Terminal Model %alias "IE_TT_MODEL"

%constant %integer Visual 200  = 0,
                   Visual 55   = 1,
                   VT100       = 2,
                   VT220       = 3,
                   Freedom 100 = 4,
                   WY 50       = 5,
                   WY 75       = 6,
                   Esprit      = 7,
                   Newbury     = 8,
                   VT52        = 9

%external %routine %spec Set Terminal Characteristics %alias "IE_TT_STC"

%external %integer %spec Terminal Characteristics %alias "IE_TT_CHAR"

%constant %integer Delete Character Ability = 2_0000000000000001,
                   Reverse Scroll   Ability = 2_0000000000000010,
                   Bright Text      Ability = 2_0000000000000100,
                   Dim Text         Ability = 2_0000000000001000,
                   Wasteful      Attributes = 2_1000000000000000,
                   Reverse Text     Ability = 2_0000000001000000,
                   Blink Text       Ability = 2_0001000000000000,
                   Underline Text   Ability = 2_0000000000100000,
                   Double Width     Ability = 2_0000100000000000,
                   Double Height    Ability = 2_0000000000010000,
                   Static Insert    Ability = 2_0000000010000000,
                   Dynamic Insert   Ability = 2_0000000100000000,
                   Noisy Insert     Ability = 2_0000001000000000,
                   Supress Cursor   Ability = 2_0010000000000000,
                   Line 25          Ability = 2_0100000000000000

%constant %integer Insert Mask = Static Insert Ability! %c
                                 Dynamic Insert Ability! %c
                                 Noisy Insert Ability

%external %integer %spec Terminal Width %alias "IE_TT_WIDTH"

%external %integer %function %spec get symbol %alias "IE_GET_SYMBOL"
%external %routine %spec put symbol %alias "IE_PUT_SYMBOL" (%integer ch)
%external %routine %spec Put String %alias "IE_PUT_STRING" (%string (255) S)
%external %routine %spec Put Integer %alias "IE_PUT_INTEGER" (%integer N)
%external %routine %spec Put Hex %alias "IE_PUT_HEX" (%integer N)
%external %routine %spec flush symbols %alias "IE_FLUSH_SYMBOLS"

!VAX!%external %integer %spec Interrupted %alias "IE_INTERRUPTED"
{APM}%external %integer %function %spec Interrupted %alias "IE_INTERRUPTED"

%external %routine %spec Cursor %alias "IE_TT_CURSOR" (%integer X, Y)
%external %routine %spec Forward Scroll %alias "IE_TT_FS" (%integer Top, Bottom)
%external %routine %spec Reverse Scroll %alias "IE_TT_RS" (%integer Top, Bottom)
%external %routine %spec Clear Line %alias "IE_TT_CL"
%external %routine %spec Clear Screen %alias "IE_TT_CS"
%external %routine %spec Erase Line %alias "IE_TT_EL"
%external %routine %spec Left  %alias "IE_TT_C_L"
%external %routine %spec Right %alias "IE_TT_C_R"
%external %routine %spec Up    %alias "IE_TT_C_U"
%external %routine %spec Down  %alias "IE_TT_C_D"

%external %routine %spec Keypad On  %alias "IE_TT_KP_1"
%external %routine %spec Keypad Off %alias "IE_TT_KP_0"

%external %routine %spec Feature %alias "IE_TT_FANCY"
%external %routine %spec Dim On %alias "IE_TT_DIM"
%external %routine %spec Reverse On %alias "IE_TT_REVERSE"
%external %routine %spec Underline On %alias "IE_TT_UNDERLINE"
%external %routine %spec Blink On %alias "IE_TT_BLINK"
%external %routine %spec Normal  %alias "IE_TT_NORMAL"

%external %routine %spec Upper Half Double Height %alias "IE_TT_DHU"
%external %routine %spec Lower Half Double Height %alias "IE_TT_DHL"
%external %routine %spec Double Width On %alias "IE_TT_DW"
%external %routine %spec Normal Size %alias "IE_TT_NS"

%external %routine %spec Graph On  %alias "IE_GR_1"
%external %routine %spec Graph Off %alias "IE_GR_0"

%external %routine %spec Yen Sign    %alias "IE_GR_YEN"
%external %routine %spec Degree Sign %alias "IE_GR_DEG"
%external %routine %spec TAB Representation %alias "IE_GR_TAB"

%external %routine %spec Left T      %alias "IE_GR_L_T"
%external %routine %spec Top Left    %alias "IE_GR_TL"
%external %routine %spec Horizontal  %alias "IE_GR_HOR"
%external %routine %spec Vertical    %alias "IE_GR_VER"
%external %routine %spec Top Right   %alias "IE_GR_TR"
%external %routine %spec Bottom Right %alias "IE_GR_BR"
%external %routine %spec Bottom Left %alias "IE_GR_BL"
%external %routine %spec Right T     %alias "IE_GR_R_T"
%external %routine %spec Top T       %alias "IE_GR_T_T"
%external %routine %spec Bottom T    %alias "IE_GR_B_T"
%external %routine %spec Cross       %alias "IE_GR_X"

%external %routine %spec Cursor On  %alias "IE_TT_CUR_1"
%external %routine %spec Cursor Off %alias "IE_TT_CUR_0"

%external %routine %spec Delete Characters %alias "IE_TT_DC" (%integer N)
%external %routine %spec Insert On  %alias "IE_TT_IC_1"
%external %routine %spec Insert Off %alias "IE_TT_IC_0"
%external %routine %spec Static Insert %alias "IE_TT_IC_S" (%integer N)

%external %routine %spec Put Line 25 %alias "IE_PUT_25" (%string (80) Text)
%external %routine %spec Close Line 25 %alias "IE_25_0"

%external %string (255) %function %spec Key Name %alias "IE_KEY_NAME" %c
                                                 (%integer Key)
%external %byte %function %spec Get Key %alias "IE_KEY_GET"

%constant %integer NUL = 0,
                   SOH = 1,
                   STX = 2,
                   ETX = 3,
                   EOT = 4,
                   ENQ = 5,
                   ACK = 6,
                   BEL = 7,
                   BS  = 8,
                   TAB = 9, HT = TAB,
                   LF  = 10,
                   VT  = 11,
                   FF  = 12,
                   CR  = 13,
                   SO  = 14,
                   SI  = 15,
                   DLE = 16,
                   DC1 = 17, XON  = DC1,
                   DC2 = 18,
                   DC3 = 19, XOFF = DC3,
                   DC4 = 20,
                   NAK = 21,
                   SYN = 22,
                   ETB = 23,
                   CAN = 24,
                   EM  = 25,
                   SUB = 26,
                   ESC = 27,
                   FS  = 28,
                   GS  = 29,
                   {RS  = 30,  Bloody AtDecs...}
                   US  = 31,
                   DEL = 127
   
%constant %integer Extra Keys = 128

%constant %integer Unknown Key = Extra Keys ! 0

{Cursor Keys}

%constant %integer Up    Key = Extra Keys ! 1,
                   Down  Key = Extra Keys ! 2,
                   Right Key = Extra Keys ! 3,
                   Left  Key = Extra Keys ! 4


{Keypad Numbers}

%constant %integer Keypad 0 = Extra Keys ! 10,
                   Keypad 1 = Extra Keys ! 11,
                   Keypad 2 = Extra Keys ! 12,
                   Keypad 3 = Extra Keys ! 13,
                   Keypad 4 = Extra Keys ! 14,
                   Keypad 5 = Extra Keys ! 15,
                   Keypad 6 = Extra Keys ! 16,
                   Keypad 7 = Extra Keys ! 17,
                   Keypad 8 = Extra Keys ! 18,
                   Keypad 9 = Extra Keys ! 19

{Keypad odd keys}

%constant %integer Keypad Comma = Extra Keys ! 20,
                   Keypad Dot   = Extra Keys ! 21,
                   Keypad Minus = Extra Keys ! 22,
                   Keypad Enter = Extra Keys ! 23

{Keypad with Function}

%constant %integer Function Keypad 0 = Extra Keys ! 30,
                   Function Keypad 1 = Extra Keys ! 31,
                   Function Keypad 2 = Extra Keys ! 32,
                   Function Keypad 3 = Extra Keys ! 33,
                   Function Keypad 4 = Extra Keys ! 34,
                   Function Keypad 5 = Extra Keys ! 35,
                   Function Keypad 6 = Extra Keys ! 36,
                   Function Keypad 7 = Extra Keys ! 37,
                   Function Keypad 8 = Extra Keys ! 38,
                   Function Keypad 9 = Extra Keys ! 39

{Keypad Odd Keys Shifted}

%constant %integer Function Keypad Comma = Extra Keys ! 40,
                   Function Keypad Dot   = Extra Keys ! 41,
                   Function Keypad Minus = Extra Keys ! 42,
                   Function Keypad Enter = Extra Keys ! 43

{Function Keys}

%constant %integer Key F0 = Extra Keys ! 50,
                   Key F1 = Extra Keys ! 51,
                   Key F2 = Extra Keys ! 52,
                   Key F3 = Extra Keys ! 53,
                   Key F4 = Extra Keys ! 54,
                   Key F5 = Extra Keys ! 55,
                   Key F6 = Extra Keys ! 56,
                   Key F7 = Extra Keys ! 57,
                   Key F8 = Extra Keys ! 58,
                   Key F9 = Extra Keys ! 59,
                   Key F10 = Extra Keys ! 60,
                   Key F11 = Extra Keys ! 61,
                   Key F12 = Extra Keys ! 62,
                   Key F13 = Extra Keys ! 63,
                   Key F14 = Extra Keys ! 64,
                   Key F15 = Extra Keys ! 65

%constant %integer Key F16 = Extra Keys ! 66,
                   Key F17 = Extra Keys ! 67,
                   Key F18 = Extra Keys ! 68,
                   Key F19 = Extra Keys ! 69,
                   Key F20 = Extra Keys ! 70,
                   Key F21 = Extra Keys ! 71,
                   Key F22 = Extra Keys ! 72,
                   Key F23 = Extra Keys ! 73,
                   Key F24 = Extra Keys ! 74,
                   Key F25 = Extra Keys ! 75,
                   Key F26 = Extra Keys ! 76,
                   Key F27 = Extra Keys ! 77,
                   Key F28 = Extra Keys ! 78,
                   Key F29 = Extra Keys ! 79,
                   Key F30 = Extra Keys ! 80,
                   Key F31 = Extra Keys ! 81,
                   Key F32 = Extra Keys ! 82

{Any odd other keys}

{All terminals}
%constant %integer Panic Key = Extra Keys ! 100

{VT100 and VT220}
%constant %integer PF1 Key = Extra Keys ! 101,
                   PF2 Key = Extra Keys ! 102,
                   PF3 Key = Extra Keys ! 103,
                   PF4 Key = Extra Keys ! 104,
                   Function PF2 = PF2 Key + 20,
                   Function PF3 = PF3 Key + 20,
                   Function PF4 = PF4 Key + 20

{Visual 200 and Visual 55}
%constant %integer Home  Key = Extra Keys ! 105,
                   BTAB  Key = Extra Keys ! 106

{Visual 200 only}
%constant %integer CP    Key = Extra Keys ! 107,
                   CL    Key = Extra Keys ! 108 

{VT220}
%constant %integer Help Key = Key F15,
                   Do   Key = Key F16,
                   Find Key = Extra Keys ! 109,
                   Insert Here Key = Extra Keys ! 110,
                   Remove Key = Extra Keys ! 111,
                   Select Key = Extra Keys ! 112,
                   Prev Screen Key = Extra Keys ! 113,
                   Next Screen Key = Extra Keys ! 114

{Freedom 100}

%constant %integer Del Line Key = Extra Keys ! 115,
                   Ins Line Key = Extra Keys ! 116,
                   Del Char Key = Extra Keys ! 117,
                   Ins Char Key = Extra Keys ! 118,
                   CLR Key      = Extra Keys ! 119,
                   Print Key    = Extra Keys ! 120

{Function PF1 = ! 122}
{Function PF2 = ! 123}
{Function PF3 = ! 124}

{WYSE 50}

%constant %integer Shift Home Key = Extra Keys ! 121,
                   Send Key       = Extra Keys ! 125,
                   Ins Key        = Extra Keys ! 126,
                   Repl Key       = Extra Keys ! 127

%end %of %file
