sourcelib/Terminal.xtl

1⍝│ Terminal: the names of the colors and keys a program draws and reads 2⍝│ with, a standard library built into xetal. Import it with an alias 3⍝│ of your choice: "t:" u_se< "Terminal". 4⍝│ 5⍝│ Colors are values of type Color (for []F_G and []B_G); keys are values 6⍝│ of type Key, what []K_EY @ gives (a printing key carries its 7⍝│ character: []K_CHAR). A misspelled name is an undefined name, and a 8⍝│ Key where a Color is wanted a type error, when the program is checked. 9 10⍝━━ Colors 11 12⍝│ The color black, for []F_G (text) and []B_G (background). 13ˡBLACK ← ⎕C̲OLOR 1 14 15⍝│ The color red, for []F_G (text) and []B_G (background). 16ˡRED ← ⎕C̲OLOR 2 17 18⍝│ The color green, for []F_G (text) and []B_G (background). 19ˡGREEN ← ⎕C̲OLOR 3 20 21⍝│ The color yellow, for []F_G (text) and []B_G (background). 22ˡYELLOW ← ⎕C̲OLOR 4 23 24⍝│ The color blue, for []F_G (text) and []B_G (background). 25ˡBLUE ← ⎕C̲OLOR 5 26 27⍝│ The color magenta, for []F_G (text) and []B_G (background). 28ˡMAGENTA ← ⎕C̲OLOR 6 29 30⍝│ The color cyan, for []F_G (text) and []B_G (background). 31ˡCYAN ← ⎕C̲OLOR 7 32 33⍝│ The color white, for []F_G (text) and []B_G (background). 34ˡWHITE ← ⎕C̲OLOR 8 35 36⍝━━ Keys 37 38⍝│ The up arrow key. A Key, compared with what []K_EY @ gives. 39ˡUP ← ⎕K̲NAMED 1 40 41⍝│ The down arrow key. A Key, compared with what []K_EY @ gives. 42ˡDOWN ← ⎕K̲NAMED 2 43 44⍝│ The left arrow key. A Key, compared with what []K_EY @ gives. 45ˡLEFT ← ⎕K̲NAMED 3 46 47⍝│ The right arrow key. A Key, compared with what []K_EY @ gives. 48ˡRIGHT ← ⎕K̲NAMED 4 49 50⍝│ The Enter (Return) key. A Key, compared with what []K_EY @ gives. 51ˡENTER ← ⎕K̲NAMED 5 52 53⍝│ The Escape key. A Key, compared with what []K_EY @ gives. 54ˡESCAPE ← ⎕K̲NAMED 6 55 56⍝│ The Backspace key. A Key, compared with what []K_EY @ gives. 57ˡBACKSPACE ← ⎕K̲NAMED 7 58 59⍝│ The Tab key. A Key, compared with what []K_EY @ gives. 60ˡTAB ← ⎕K̲NAMED 8 61 62⍝│ The Delete key. A Key, compared with what []K_EY @ gives. 63ˡDELETE ← ⎕K̲NAMED 9 64 65⍝│ The Home key. A Key, compared with what []K_EY @ gives. 66ˡHOME ← ⎕K̲NAMED 10 67 68⍝│ The End key. A Key, compared with what []K_EY @ gives. 69ˡEND ← ⎕K̲NAMED 11 70 71⍝━━ Keys