[31m-- Skywalker is another attempt of A. i. written with Ada.[m
[31m-- Skywalker is Copyright (C) 2024 Manuel De Girardi ; [m
[31m--[m
[31m--   This program is free software; you can redistribute it and/or modify[m
[31m--   it under the terms of the GNU General Public License as published by[m
[31m--   the Free Software Foundation; either version 2 of the License, or[m
[31m--   (at your option) any later version.[m
[31m--[m
[31m--   This program is distributed in the hope that it will be useful,[m
[31m--   but WITHOUT ANY WARRANTY; without even the implied warranty of[m
[31m--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the[m
[31m--   GNU General Public License for more details.[m
[31m--[m
[31m--   You should have received a copy of the GNU General Public License[m
[31m--   along with this program; if not, write to the Free Software[m
[31m--   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA[m
[31m--[m
[31m-- Date := "2024-11-12 09:45:23"[m
[31m-- Version := "0.0.8r"[m
[01;34mwith[m Ada[31m.[mWide_Text_IO[31m;[m

[31m-- Code page of this file : Windows west Europe[m
[31m-- Tabulation : 3[m
[31m-- Contact : les-ziboux@rasama.org[m

[01;34mpackage[m Sky[31m.[mAnsi[31m.[mConsole
    [31m-- ----------------------------------------------------------------------------[m
[31m-- High Level Text Mode Screen and Console Output.[m
[31m-- Also Provide Keystroke Assignement.[m
[31m-- ----------------------------------------------------------------------------[m
[31m-- This package provide access to high level output to text mode screen[m
[31m-- and console. It allows you to set cursor position, text color, erase[m
[31m-- screen, and other useful procedures of the like. Enable to assign keystroke[m
[31m-- to string : i.e. when the specified keystroke occur, the corresponding[m
[31m-- string is recieved on the standard input (to be used with care).[m
[31m--[m
[31m-- It interfaces all ANSI escapement commands. Symbolic types defined in[m
[31m-- the ANSI standard are used to document types definitions founded here.[m
[31m-- Procedure names differ from command names found in the ANSI standard.[m
[31m-- Generic commande string representations are used to document procedures.[m
[31m--[m
[31m-- Contact : les-ziboux@rasama.org[m
[31m--[m
[31m-- To learn further more about this package, you may read the following page :[m
[31m-- http://www.les-ziboux.rasama.org/ada-commandes-echappement-ansi.html[m
[31m-- Use free of charge as long as the latter link is kept in this file and[m
[31m-- given in application credits.[m
[31m--[m
[31m-- Modified versions are allowed for personal use only and not for distributed[m
[31m-- softwares (free of charge or not). Please : send me feed-back for any[m
[31m-- request, included suspected bug, request for functionality, suspect wrong[m
[31m-- behaviour, and any thing else, and do not distribut modified version.[m
[31m--[m
[31m-- Saturday, November 25 - 2006 - france (somewhere in europe ...)[m
[31m-- ----------------------------------------------------------------------------[m

[01;34mis[m

   [31m-- =========================================================================[m
   [31m-- Important notes :[m
   [31m-- -------------------------------------------------------------------------[m
   [31m-- o	Output of text (not of command) that just fit up to[m
   [31m-- 	en of line, may move the cursor to the line below. This[m
   [31m-- 	occur on many systems.[m
   [31m-- o	Continuating the previous note, if in the same circumstances, the[m
   [31m-- 	cursor in on the bottom line, the a screen scroll may occur on[m
   [31m-- 	many systems. Applications should care about it, or use a special[m
   [31m-- 	way to avoid this behavior.[m
   [31m-- o	As this package is reentrant, it is thread safe.[m
   [31m-- o	There is a « Beep » procedure under section of output procedures.[m
   [31m-- o	There is a (non-blocking) « Get_Key » procedure under the section[m
   [31m-- 	of input procedures.[m
   [31m-- =========================================================================[m
   [31m-- Organisation of this specification[m
   [31m-- -------------------------------------------------------------------------[m
   [31m-- O Screen metrics[m
   [31m-- o		Types for screen metrics (screen maximum sizes)[m
   [31m-- o		Types for screen positions[m
   [31m-- O Keystrokes[m
   [31m-- o		Type for normal keys[m
   [31m-- o		Type for modifier keys[m
   [31m-- O Text output/input and erasing of screen[m
   [31m-- o		Type for working on streams other than the standard output.[m
   [31m-- o		Simply text output procedures (provided for consistency).[m
   [31m-- o		Simply character output procedures (provided for consistency).[m
   [31m-- o		Procedure for playing a beep[m
   [31m-- o		Simply character input procedures (provided for consistency).[m
   [31m-- o		Type for keystroke input[m
   [31m-- o		Procedures for keystroke input[m
   [31m-- o		Procedures for clearing screen or part of line.[m
   [31m-- O Text color and attributes[m
   [31m-- o		Type for setting foreground and background text colors[m
   [31m-- o		Procedures for setting text color.[m
   [31m-- o		Type for setting text attributes[m
   [31m-- o		Procedure for setting text attributs (blinking and the like...).[m
   [31m-- O Cursor position and movement[m
   [31m-- o		Procedure fixing cursor position[m
   [31m-- o		Types for making cursor mouvements (deltas).[m
   [31m-- o		Procedures moving cursor position[m
   [31m-- o		Procedures for saving/restoring cursor position[m
   [31m-- O Screen modes (resolution) and output behaviour[m
   [31m-- o		Type for setting screen modes (screen resolution)[m
   [31m-- o		Procedures for fixing screen mode (screen resolution)[m
   [31m-- o		Procedures for fixing screen behaviour (line wrapping)[m
   [31m-- O Key assignements[m
   [31m-- o     Exception for invalid modifier+key[m
   [31m-- o		Procedure for assigning key-stroke to string[m

   [31m-- =========================================================================[m
   [31m-- Screen metrics[m
   [31m-- -------------------------------------------------------------------------[m

   [31m-- Note : screen coordinates are top to down and left to right.[m
   [31m-- Note : the upper left corner is (1,1).[m

   [31m-- Types for screen metrics (screen maximum sizes)[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   Maximum_Screen_Height [31m:[m [01;34mconstant[m Positive [31m:=[m [35m1024[m[31m;[m
   Maximum_Screen_Width  [31m:[m [01;34mconstant[m Positive [31m:=[m [35m1024[m[31m;[m

   [31m-- Types for screen positions[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34msubtype[m Vertical_Position_Type   [01;34mis[m Positive [31m-- Implements PL[m
     [01;34mrange[m [35m1[m[31m..[mMaximum_Screen_Height[31m;[m

   [01;34msubtype[m Horizontal_Position_Type [01;34mis[m Positive [31m-- Implements Pc[m
     [01;34mrange[m [35m1[m[31m..[mMaximum_Screen_Width[31m;[m

   [31m-- =========================================================================[m
   [31m-- Keystrokes[m
   [31m-- -------------------------------------------------------------------------[m

   [31m-- Type for normal keys[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34mtype[m Key_Type [01;34mis[m [31m([m [31m-- Type for functional keys (those you usualy use)[m
		      Key_F1[31m,[m
		      Key_F2[31m,[m
		      Key_F3[31m,[m
		      Key_F4[31m,[m
		      Key_F5[31m,[m
		      Key_F6[31m,[m
		      Key_F7[31m,[m
		      Key_F8[31m,[m
		      Key_F9[31m,[m
		      Key_F10[31m,[m
		      Key_F11[31m,[m
		      Key_F12[31m,[m
		      Keypad_Home[31m,[m
		      Keypad_Up_Arrow[31m,[m
		      Keypad_Page_Up[31m,[m
		      Keypad_Left_Arrow[31m,[m
		      Keypad_Right_Arrow[31m,[m
		      Keypad_End[31m,[m
		      Keypad_Down_Arrow[31m,[m
		      Keypad_Page_Down[31m,[m
		      Keypad_Insert[31m,[m
		      Keypad_Delete[31m,[m
		      Key_Home[31m,[m
		      Key_Up_Arrow[31m,[m
		      Key_Page_Up[31m,[m
		      Key_Left_Arrow[31m,[m
		      Key_Right_Arrow[31m,[m
		      Key_End[31m,[m
		      Key_Down_Arrow[31m,[m
		      Key_Page_Down[31m,[m
		      Key_Insert[31m,[m
		      Key_Delete[31m,[m
		      Key_Print_Screen[31m,[m
		      Key_Pause_Break[31m,[m
		      Key_Escape[31m,[m
		      Key_Backspace[31m,[m
		      Key_Enter[31m,[m
		      Key_Tab[31m,[m
		      Key_Null[31m,[m
		      Key_A[31m,[m
		      Key_B[31m,[m
		      Key_C[31m,[m
		      Key_D[31m,[m
		      Key_E[31m,[m
		      Key_F[31m,[m
		      Key_G[31m,[m
		      Key_H[31m,[m
		      Key_I[31m,[m
		      Key_J[31m,[m
		      Key_K[31m,[m
		      Key_L[31m,[m
		      Key_M[31m,[m
		      Key_N[31m,[m
		      Key_O[31m,[m
		      Key_P[31m,[m
		      Key_Q[31m,[m
		      Key_R[31m,[m
		      Key_S[31m,[m
		      Key_T[31m,[m
		      Key_U[31m,[m
		      Key_V[31m,[m
		      Key_W[31m,[m
		      Key_X[31m,[m
		      Key_Y[31m,[m
		      Key_Z[31m,[m
		      Key_0[31m,[m
		      Key_1[31m,[m
		      Key_2[31m,[m
		      Key_3[31m,[m
		      Key_4[31m,[m
		      Key_5[31m,[m
		      Key_6[31m,[m
		      Key_7[31m,[m
		      Key_8[31m,[m
		      Key_9[31m,[m
		      Key_Minus[31m,[m
		      Key_Equal[31m,[m
		      Key_Left_Square[31m,[m
		      Key_Right_Square[31m,[m
		      Key_Space[31m,[m
		      Key_Semicolon[31m,[m
		      Key_Single_Quote[31m,[m
		      Key_Comma[31m,[m
		      Key_Dot[31m,[m
		      Key_Slash[31m,[m
		      Key_Left_Single_Quote[31m,[m
		      Keypad_Enter[31m,[m
		      Keypad_Slash[31m,[m
		      Keypad_Star[31m,[m
		      Keypad_Minus[31m,[m
		      Keypad_Plus[31m,[m
		      Keypad_Middle[31m);[m [31m-- 5, in the middle of the numeric keypad[m

   [31m-- Type for modifier keys[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34mtype[m Modifier_Key_Type [01;34mis[m [31m([m [31m-- Type for auxiliary keys (the one you[m
			       No_Modifier_Key[31m,[m         [31m-- held down while pressing another)[m
			       Shift_Key[31m,[m
			       Ctrl_Key[31m,[m
			       Alt_Key[31m);[m

   [31m-- =========================================================================[m
   [31m-- Text output/input and erasing of screen[m
   [31m-- -------------------------------------------------------------------------[m

   [31m-- Type for working on streams other than the standard output.[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34msubtype[m Stream_Type [01;34mis[m Ada[31m.[mWide_Text_IO[31m.[mFile_Type[31m;[m

   [31m-- Simply text output procedures (provided for consistency).[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34mprocedure[m [01;30mPut[m [31m([m
		  Text   [31m:[m [01;34min[m [32mWide_String[m[31m);[m

   [01;34mprocedure[m [01;30mPut[m [31m([m
		  Stream [31m:[m [01;34min[m Stream_Type[31m;[m
		  Text   [31m:[m [01;34min[m [32mWide_String[m[31m);[m

   [01;34mprocedure[m [01;30mPut[m [31m([m
		  Line   [31m:[m [01;34min[m Vertical_Position_Type[31m;[m
		  Column [31m:[m [01;34min[m Horizontal_Position_Type[31m;[m
		  Text   [31m:[m [01;34min[m [32mWide_String[m[31m);[m

   [01;34mprocedure[m [01;30mPut[m [31m([m
		  Stream [31m:[m [01;34min[m Stream_Type[31m;[m
		  Line   [31m:[m [01;34min[m Vertical_Position_Type[31m;[m
		  Column [31m:[m [01;34min[m Horizontal_Position_Type[31m;[m
		  Text   [31m:[m [01;34min[m [32mWide_String[m[31m);[m

   [31m-- Simply character output procedures (provided for consistency).[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34mprocedure[m [01;30mPut[m [31m([m
		  C [31m:[m [01;34min[m Wide_Character[31m);[m
   
   [01;34mprocedure[m [01;30mEnlight_Put[m [31m([m
			  C [31m:[m [01;34min[m Wide_Character[31m);[m

   [01;34mprocedure[m [01;30mPut[m [31m([m
		  Stream [31m:[m [01;34min[m Stream_Type[31m;[m
		  C      [31m:[m [01;34min[m Wide_Character[31m);[m

   [01;34mprocedure[m [01;30mPut[m [31m([m
		  Line   [31m:[m [01;34min[m Vertical_Position_Type[31m;[m
		  Column [31m:[m [01;34min[m Horizontal_Position_Type[31m;[m
		  C      [31m:[m [01;34min[m Wide_Character[31m);[m

   [01;34mprocedure[m [01;30mPut[m [31m([m
		  Stream [31m:[m [01;34min[m Stream_Type[31m;[m
		  Line   [31m:[m [01;34min[m Vertical_Position_Type[31m;[m
		  Column [31m:[m [01;34min[m Horizontal_Position_Type[31m;[m
		  C      [31m:[m [01;34min[m Wide_Character[31m);[m

   [31m-- Procedure for playing a beep[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34mprocedure[m Beep[31m;[m [31m-- Added for convenience - See note below[m

   [01;34mprocedure[m [01;30mBeep[m [31m([mStream [31m:[m [01;34min[m Stream_Type[31m);[m

   [31m-- Note : with console under some modern desktop environements, like[m
   [31m-- Windows, the beep function may play the system altert sound instead of a[m
   [31m-- beep with the computer speaker.[m

   [31m-- Simply character input procedures (provided for consistency).[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [31m-- See notes below about Get procedures[m

   [01;34mprocedure[m [01;30mGet[m [31m([m
		  C [31m:[m [01;34mout[m Wide_Character[31m);[m

   [01;34mprocedure[m [01;30mGet[m [31m([m [31m-- Non-blocking character input.[m
		  C         [31m:[m [01;34mout[m Wide_Character[31m;[m
		  Available [31m:[m [01;34mout[m [32mBoolean[m[31m);[m

   [01;34mprocedure[m [01;30mGet[m [31m([m
		  Stream [31m:[m [01;34min[m Stream_Type[31m;[m
		  C      [31m:[m [01;34mout[m Wide_Character[31m);[m

   [01;34mprocedure[m [01;30mGet[m [31m([m [31m-- Non-blocking character input.[m
		  Stream    [31m:[m [01;34min[m Stream_Type[31m;[m
		  C         [31m:[m [01;34mout[m Wide_Character[31m;[m
		  Available [31m:[m [01;34mout[m [32mBoolean[m[31m);[m

   [31m-- Type for keystroke input[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34mtype[m Keystroke_Input_Type [01;34mis[m
      [01;34mrecord[m
	 Key                 [31m:[m Key_Type[31m;[m
	 Modifier_Key        [31m:[m Modifier_Key_Type[31m;[m
	 C                   [31m:[m Wide_Character[31m;[m
	 Key_Available       [31m:[m [32mBoolean[m[31m;[m
	 Character_Available [31m:[m [32mBoolean[m[31m;[m
      [01;34mend[m [01;34mrecord[m[31m;[m

   [31m-- Procedures for keystroke input[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34mprocedure[m [01;30mGet_Key[m [31m([m [31m-- Non-blocking key input - See note below[m
		      Keystroke_Input [31m:[m [01;34mout[m Keystroke_Input_Type[31m);[m

   [01;34mprocedure[m [01;30mGet_Key[m [31m([m
		      Stream          [31m:[m [01;34min[m Stream_Type[31m;[m
		      Keystroke_Input [31m:[m [01;34mout[m Keystroke_Input_Type[31m);[m

   [31m-- Notes[m
   [31m-- -------------------------------------------------------------------------[m
   [31m-- Some keystroke only have a specific code. See the list below, of[m
   [31m-- recognize keystrokes. Unfortunatly, Ctrl+PageUp has the same code[m
   [31m-- as F12. So when you hit Ctrl+PageUp, it appears as F12. There is[m
   [31m-- no work around. In general, Key F11 and F12 are not well supported[m
   [31m-- by ANSI (multiplicity of codes or ambiguity with some other codes).[m
   [31m--[m
   [31m-- Get can return special character code, meaning complex keystroke,[m
   [31m-- so it is suggested to use Get_Key instead of Get. Get_Key translate[m
   [31m-- and convert special code automaticaly, so you don't have to worry[m
   [31m-- about them. Get_Key allow you too to get character input, and prevent[m
   [31m-- you from errorneously getting special code in place of character input.[m
   [31m--[m
   [31m-- Get_Key is provided for convenience, and may be incomaptible with Get[m
   [31m-- (not all the time but in some circumstance). Some complex key, like F1,[m
   [31m-- Page-up and so on, a recieved through complex code, made of two[m
   [31m-- conscecutives specials character codes. So you easly guess that Get_Key[m
   [31m-- is based on Get, and that a missusage of Get may disturbe Get_Key.[m
   [31m-- Althought the « normal » way wit ANSI consoles is to call Get, it[m
   [31m-- is strongly adviced that you only use Get_Key in your application.[m
   [31m--[m
   [31m-- Here is the list of recognize keystrokes ...[m
   [31m--[m
   [31m-- Standalones keys (A-Z and 0-1 are not reported in this list, but[m
   [31m-- are recognized too).[m
   [31m--[m
   [31m-- Key_F1[m
   [31m-- Key_F2[m
   [31m-- Key_F3[m
   [31m-- Key_F4[m
   [31m-- Key_F5[m
   [31m-- Key_F6[m
   [31m-- Key_F7[m
   [31m-- Key_F8[m
   [31m-- Key_F9[m
   [31m-- Key_F10[m
   [31m-- Key_F11[m
   [31m-- Key_F12[m
   [31m-- Key_Home[m
   [31m-- Key_Up_Arrow[m
   [31m-- Key_Page_Up[m
   [31m-- Key_Left_Arrow[m
   [31m-- Key_Right_Arrow[m
   [31m-- Key_End[m
   [31m-- Key_Down_Arrow[m
   [31m-- Key_Page_Down[m
   [31m-- Key_Insert[m
   [31m-- Key_Delete[m
   [31m-- Key_Backspace[m
   [31m-- Key_Tab[m
   [31m-- Key_Enter[m
   [31m-- Key_Escape[m
   [31m-- Key_Space[m
   [31m--[m
   [31m-- Keypad keys (there may be not distinguisable on some system)[m
   [31m--[m
   [31m-- Keypad_Home[m
   [31m-- Keypad_Up_Arrow[m
   [31m-- Keypad_Page_Up[m
   [31m-- Keypad_Left_Arrow[m
   [31m-- Keypad_Right_Arrow[m
   [31m-- Keypad_End[m
   [31m-- Keypad_Down_Arrow[m
   [31m-- Keypad_Page_Down[m
   [31m-- Keypad_Insert[m
   [31m-- Keypad_Delete[m
   [31m--[m
   [31m-- With ALT modifier[m
   [31m--[m
   [31m-- Alt_Key + Key_F1[m
   [31m-- Alt_Key + Key_F2[m
   [31m-- Alt_Key + Key_F3[m
   [31m-- Alt_Key + Key_F4[m
   [31m-- Alt_Key + Key_F5[m
   [31m-- Alt_Key + Key_F6[m
   [31m-- Alt_Key + Key_F7[m
   [31m-- Alt_Key + Key_F8[m
   [31m-- Alt_Key + Key_F9[m
   [31m-- Alt_Key + Key_F10[m
   [31m-- Alt_Key + Key_F11[m
   [31m-- Alt_Key + Key_F12[m
   [31m-- Alt_Key + Key_Home[m
   [31m-- Alt_Key + Key_Up_Arrow[m
   [31m-- Alt_Key + Key_Page_Up[m
   [31m-- Alt_Key + Key_Left_Arrow[m
   [31m-- Alt_Key + Key_Right_Arrow[m
   [31m-- Alt_Key + Key_End[m
   [31m-- Alt_Key + Key_Down_Arrow[m
   [31m-- Alt_Key + Key_Page_Down[m
   [31m-- Alt_Key + Key_Insert[m
   [31m-- Alt_Key + Key_Delete[m
   [31m--[m
   [31m-- With CTRL modifier[m
   [31m--[m
   [31m-- Ctrl_Key + Key_F1[m
   [31m-- Ctrl_Key + Key_F2[m
   [31m-- Ctrl_Key + Key_F3[m
   [31m-- Ctrl_Key + Key_F4[m
   [31m-- Ctrl_Key + Key_F5[m
   [31m-- Ctrl_Key + Key_F6[m
   [31m-- Ctrl_Key + Key_F7[m
   [31m-- Ctrl_Key + Key_F8[m
   [31m-- Ctrl_Key + Key_F9[m
   [31m-- Ctrl_Key + Key_F10[m
   [31m-- Ctrl_Key + Key_F11[m
   [31m-- Ctrl_Key + Key_F12[m
   [31m-- Ctrl_Key + Key_Home[m
   [31m-- Ctrl_Key + Key_Up_Arrow[m
   [31m-- Ctrl_Key + Key_Left_Arrow[m
   [31m-- Ctrl_Key + Key_Right_Arrow[m
   [31m-- Ctrl_Key + Key_End[m
   [31m-- Ctrl_Key + Key_Down_Arrow[m
   [31m-- Ctrl_Key + Key_Page_Down[m
   [31m-- Ctrl_Key + Key_Insert[m
   [31m-- Ctrl_Key + Key_Delete[m
   [31m-- Ctrl_Key + Keypad_Home[m
   [31m-- Ctrl_Key + Keypad_Up_Arrow[m
   [31m-- Ctrl_Key + Keypad_Page_Up[m
   [31m-- Ctrl_Key + Keypad_Left_Arrow[m
   [31m-- Ctrl_Key + Keypad_Right_Arrow[m
   [31m-- Ctrl_Key + Keypad_End[m
   [31m-- Ctrl_Key + Keypad_Down_Arrow[m
   [31m-- Ctrl_Key + Keypad_Page_Down[m
   [31m-- Ctrl_Key + Keypad_Insert[m
   [31m-- Ctrl_Key + Keypad_Delete[m
   [31m-- Ctrl_Key + Key_Tab[m
   [31m--[m
   [31m-- With SHIFT modifier[m
   [31m--[m
   [31m-- Shift_Key + Key_F1[m
   [31m-- Shift_Key + Key_F2[m
   [31m-- Shift_Key + Key_F3[m
   [31m-- Shift_Key + Key_F4[m
   [31m-- Shift_Key + Key_F5[m
   [31m-- Shift_Key + Key_F6[m
   [31m-- Shift_Key + Key_F7[m
   [31m-- Shift_Key + Key_F8[m
   [31m-- Shift_Key + Key_F9[m
   [31m-- Shift_Key + Key_F10[m
   [31m-- Shift_Key + Key_F11[m
   [31m-- Shift_Key + Key_F12[m

   [31m-- Procedures for clearing screen or part of line.[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [31m-- Note : erasing use the currently active background color.[m

   [01;34mprocedure[m Clear_Screen[31m;[m [31m-- Implements ESC[2J[m

   [01;34mprocedure[m [01;30mClear_Screen[m [31m([mStream [31m:[m [01;34min[m Stream_Type[31m);[m [31m-- idem[m

   [01;34mprocedure[m Clear_From_Cursor_Up_To_End_Of_Line[31m;[m [31m-- Implements ESC[K[m

   [01;34mprocedure[m [01;30mClear_From_Cursor_Up_To_End_Of_Line[m [31m([mStream [31m:[m [01;34min[m Stream_Type[31m);[m

   [31m-- =========================================================================[m
   [31m-- Text color and attributes[m
   [31m-- -------------------------------------------------------------------------[m

   [31m-- Type for setting foreground and background text colors[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m
   
   [01;34mtype[m Color_Type [01;34mis[m [31m([m [31m-- Implements part of Ps[m
			
			Black[31m,[m
			Red[31m,[m
			Green[31m,[m
			Yellow[31m,[m
			Blue[31m,[m
			Magenta[31m,[m
			Cyan[31m,[m
			White[31m);[m

   [31m-- Procedures for setting text color.[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34mprocedure[m [01;30mSet_Text_Color[m [31m([m [31m-- Implements part of ESC[Ps;...;Psm[m
			     Color [31m:[m [01;34min[m Color_Type[31m);[m
   
   [01;34mprocedure[m [01;30mEnlight_Text_Color[m [31m([m [31m-- Implements part of ESC[Ps;...;Psm[m
			     Color [31m:[m [01;34min[m Color_Type[31m);[m

   [01;34mprocedure[m [01;30mSet_Text_Color[m [31m([m [31m-- idem[m
			     Stream [31m:[m [01;34min[m Stream_Type[31m;[m
			     Color  [31m:[m [01;34min[m Color_Type[31m);[m

   [01;34mprocedure[m [01;30mSet_Background_Color[m [31m([m [31m-- Implements part of ESC[Ps;...;Psm[m
				   Color [31m:[m [01;34min[m Color_Type[31m);[m

   [01;34mprocedure[m [01;30mSet_Background_Color[m [31m([m [31m-- idem[m
				   Stream [31m:[m [01;34min[m Stream_Type[31m;[m
				   Color  [31m:[m [01;34min[m Color_Type[31m);[m

   [31m-- Type for setting text attributes[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34mtype[m Text_Attributes_Type [01;34mis[m [31m([m [31m-- Implements part of Ps[m
				  Default_Text_Attributes[31m,[m [31m-- Restore device defaults - See notes below[m
				  Bold_Text[31m,[m   [31m-- Displayed as highligthed on most device (reverse of Thin)[m
				  Thin_Text[31m,[m         [31m-- Displayed as faint on most device (reverse of Bold)[m
				  Standout_Text[31m,[m       [31m-- Don't know what it stand for (without joking)[m
				  Underlined_Text[31m,[m     [31m-- Only works on monochrome displays[m
				  Blinking_Text[31m,[m       [31m-- See notes below[m
				  Reversed_Colors[31m,[m     [31m-- See notes below[m
				  Hidden_Text[31m,[m         [31m-- See notes below[m
				  Normal_Text[31m,[m         [31m-- Deactivate all attributes[m
				  Not_Standout_Text[31m,[m   [31m-- To remove the standout attribute[m
				  Not_Underlined_Text[31m,[m [31m-- To remove the Underlined attribute[m
				  Not_Blinking_Text[31m,[m   [31m-- To remove the Blinking attribute[m
				  Not_Reversed_Text[31m);[m  [31m-- To remove the Reversed attribute[m

   [31m-- Notes[m
   [31m-- -------------------------------------------------------------------------[m
   [31m-- Note : Default_Text_Attributes is not a way of disabling currently[m
   [31m-- selected text attributes (use Normal_Text to do that). Instead, it[m
   [31m-- modified some text attributes on a not normalised way, while possibly[m
   [31m-- preserving some others attributes.[m
   [31m--[m
   [31m-- Note : Blinking_Text displays the text blinking (on real console) of[m
   [31m-- course, but also apply thin/faint style. So if you have, say faint[m
   [31m-- blue background color, with blue hightligh text, then the text color[m
   [31m-- become faint blue, and is not visible. When using blinking attribute,[m
   [31m-- text color and background color must have truly different colors in order[m
   [31m-- to be visible.[m
   [31m--[m
   [31m-- Note : Reversed_Colors is to be used with care. On a 16 colors display,[m
   [31m-- it may produce invisible text, due to background color becoming the[m
   [31m-- same as the text color. Color combination are to be tested before, of[m
   [31m-- course.[m
   [31m--[m
   [31m-- Note : Hidden_Text is not really invisible, but it is a work on the[m
   [31m-- background color (which generally become black).[m
   [31m-- -------------------------------------------------------------------------[m

   [31m-- Procedure for setting text attributs (blinking and the like...).[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34mprocedure[m [01;30mSet_Text_Attributes[m [31m([m [31m-- Implements part of ESC[Ps;...;Psm[m
				  Text_Attributes [31m:[m [01;34min[m Text_Attributes_Type[31m);[m

   [01;34mprocedure[m [01;30mSet_Text_Attributes[m [31m([m [31m-- idem[m
				  Stream          [31m:[m [01;34min[m Stream_Type[31m;[m
				  Text_Attributes [31m:[m [01;34min[m Text_Attributes_Type[31m);[m

   [31m-- =========================================================================[m
   [31m-- Cursor position and movement[m
   [31m-- -------------------------------------------------------------------------[m

   [31m-- Procedure fixing cursor position[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34mprocedure[m [01;30mMove_Cursor_To[m [31m([m [31m-- Implements ESC[PL;PcH  (same as ESC[PL;Pcf)[m
			     Line   [31m:[m [01;34min[m Vertical_Position_Type[31m;[m
			     Column [31m:[m [01;34min[m Horizontal_Position_Type[31m);[m

   [01;34mprocedure[m [01;30mMove_Cursor_To[m [31m([m [31m-- idem[m
			     Stream [31m:[m [01;34min[m Stream_Type[31m;[m
			     Line   [31m:[m [01;34min[m Vertical_Position_Type[31m;[m
			     Column [31m:[m [01;34min[m Horizontal_Position_Type[31m);[m

   [31m-- Types for making cursor mouvements (deltas).[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34msubtype[m Horizontal_Delta_Type [01;34mis[m Natural [31m-- Implements Pn[m
     [01;34mrange[m [35m0[m[31m..[mMaximum_Screen_Height [31m-[m [35m1[m[31m;[m

   [01;34msubtype[m Vertical_Delta_Type   [01;34mis[m Natural [31m-- Implements Pn[m
     [01;34mrange[m [35m0[m[31m..[mMaximum_Screen_Width [31m-[m [35m1[m[31m;[m

   [31m-- Procedures moving cursor position[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34mprocedure[m [01;30mMove_Cursor_Up[m [31m([m [31m-- Implements ESC[PnA[m
			     Count [31m:[m [01;34min[m Vertical_Delta_Type[31m);[m

   [01;34mprocedure[m [01;30mMove_Cursor_Up[m [31m([m [31m-- idem[m
			     Stream [31m:[m [01;34min[m Stream_Type[31m;[m
			     Count  [31m:[m [01;34min[m Vertical_Delta_Type[31m);[m

   [01;34mprocedure[m [01;30mMove_Cursor_Down[m [31m([m [31m-- Implements ESC[PnB[m
			       Count [31m:[m [01;34min[m Vertical_Delta_Type[31m);[m

   [01;34mprocedure[m [01;30mMove_Cursor_Down[m [31m([m [31m-- idem[m
			       Stream [31m:[m [01;34min[m Stream_Type[31m;[m
			       Count  [31m:[m [01;34min[m Vertical_Delta_Type[31m);[m

   [01;34mprocedure[m [01;30mMove_Cursor_Right[m [31m([m [31m-- Implements ESC[PnC[m
				Count [31m:[m [01;34min[m Horizontal_Delta_Type[31m);[m

   [01;34mprocedure[m [01;30mMove_Cursor_Right[m [31m([m [31m-- idem[m
				Stream [31m:[m [01;34min[m Stream_Type[31m;[m
				Count  [31m:[m [01;34min[m Horizontal_Delta_Type[31m);[m

   [01;34mprocedure[m [01;30mMove_Cursor_Left[m [31m([m [31m-- Implements ESC[PnD[m
			       Count [31m:[m [01;34min[m Horizontal_Delta_Type[31m);[m

   [01;34mprocedure[m [01;30mMove_Cursor_Left[m [31m([m [31m-- idem[m
			       Stream [31m:[m [01;34min[m Stream_Type[31m;[m
			       Count  [31m:[m [01;34min[m Horizontal_Delta_Type[31m);[m

   [31m-- Procedures for saving/restoring cursor position[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34mprocedure[m Save_Cursor_Position[31m;[m [31m-- Implements ESC[s[m

   [01;34mprocedure[m [01;30mSave_Cursor_Position[m [31m([mStream [31m:[m [01;34min[m Stream_Type[31m);[m [31m-- idem[m

   [01;34mprocedure[m Restore_Cursor_Position[31m;[m [31m-- Implements ESC[u[m

   [01;34mprocedure[m [01;30mRestore_Cursor_Position[m [31m([mStream [31m:[m [01;34min[m Stream_Type[31m);[m [31m-- idem[m

   [31m-- =========================================================================[m
   [31m-- Screen modes (resolution) and output behaviour[m
   [31m-- -------------------------------------------------------------------------[m

   [31m-- Type for setting screen modes (screen resolution)[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [31m-- Note that graphic screen stand for text mode based on graphic screen.[m

   [01;34mtype[m Screen_Mode_Type [01;34mis[m [31m([m [31m-- Implements part of Ps[m
			      Monochrome_Text_Mode_40x25[31m,[m      [31m-- monochrome, text[m
			      Color_Text_Mode_40x25[31m,[m           [31m-- color     , text[m
			      Monochrome_Text_Mode_80x25[31m,[m      [31m-- monochrome, text[m
			      Color_Text_Mode_80x25[31m,[m           [31m-- color     , text[m
			      Color4_Graphic_Mode_320x200[31m,[m     [31m-- 4 colors  , graphic[m
			      Monochrome_Graphic_Mode_320x200[31m,[m [31m-- monochrome, graphic[m
			      Monochrome_Graphic_Mode_640x200[31m,[m [31m-- monochrome, graphic[m
			      Color_Graphic_Mode_320x200[31m,[m      [31m-- xxx colors, graphic[m
			      Color16_Graphic_Mode_640x200[31m,[m    [31m-- 16 colors , graphic[m
			      Monochrome_Graphic_Mode_640x350[31m,[m [31m-- monochrome, graphics[m
			      Color16_Graphic_Mode_640x350[31m,[m    [31m-- 16 colors , graphic[m
			      Monochrome_Graphic_Mode_640x480[31m,[m [31m-- monochrome, graphic[m
			      Color16_Graphic_Mode_640x480[31m,[m    [31m-- 16 colors , graphic[m
			      Color256_Graphic_Mode_320x200[31m);[m  [31m-- 256 colors, graphic[m

   [31m-- Procedures for fixing screen mode (screen resolution)[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34mprocedure[m [01;30mSet_Screen_Mode[m [31m([m [31m-- Implements part of ESC[=Psh[m
			      Screen_Mode [31m:[m [01;34min[m Screen_Mode_Type[31m);[m

   [01;34mprocedure[m [01;30mSet_Screen_Mode[m [31m([m [31m-- idem[m
			      Stream      [31m:[m [01;34min[m Stream_Type[31m;[m
			      Screen_Mode [31m:[m [01;34min[m Screen_Mode_Type[31m);[m

   [01;34mprocedure[m [01;30mReset_Screen_Mode[m [31m([m [31m-- Implements ESC[=Psl[m
				Screen_Mode [31m:[m [01;34min[m Screen_Mode_Type[31m);[m

   [01;34mprocedure[m [01;30mReset_Screen_Mode[m [31m([m [31m-- idem[m
				Stream      [31m:[m [01;34min[m Stream_Type[31m;[m
				Screen_Mode [31m:[m [01;34min[m Screen_Mode_Type[31m);[m

   [31m-- Procedures for fixing screen behaviour (line wrapping)[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [01;34mprocedure[m Enable_Line_Wrapping[31m;[m [31m-- Implements part of ESC[=Psh[m

   [01;34mprocedure[m [01;30mEnable_Line_Wrapping[m [31m([mStream [31m:[m [01;34min[m Stream_Type[31m);[m [31m-- idem[m

   [01;34mprocedure[m Disable_Line_Wrapping[31m;[m [31m-- Implements part of ESC[=Psh[m

   [01;34mprocedure[m [01;30mDisable_Line_Wrapping[m [31m([mStream [31m:[m [01;34min[m Stream_Type[31m);[m [31m-- ideù[m

   [31m-- =========================================================================[m
   [31m-- Keystroke assignements[m
   [31m-- ------------------------------------------------------------------------[m

   [31m-- Exception for invalid modifier+key[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   Illegal_Keystroke [31m:[m [01;34mexception[m[31m;[m [31m-- May be raised by Assign_Keystroke[m

   [31m-- Procedure for assigning key-stroke to string[m
   [31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

   [31m-- Warning : there is no undo nor reset applying to this functionality.[m

   [31m-- Be careful that some keystrokes are illegal.[m

   [31m-- Be sure that application only use legal keystroke, or[m
   [31m-- check it with this function (may be useful for interactive keystroke[m
   [31m-- assignment from user).[m

   [01;34mfunction[m [01;30mLegal_Keystroke[m [31m([m
			     Key          [31m:[m [01;34min[m Key_Type[31m;[m
			     Modifier_Key [31m:[m [01;34min[m Modifier_Key_Type[31m)[m
			    [01;34mreturn[m [32mBoolean[m[31m;[m
   
   [01;34mprocedure[m [01;30mAssign_Keystroke[m [31m([m [31m-- Implements ESC[code;string;...p[m
			       Key          [31m:[m [01;34min[m Key_Type[31m;[m
			       Modifier_Key [31m:[m [01;34min[m Modifier_Key_Type[31m;[m
			       Substitution [31m:[m [01;34min[m [32mWide_String[m[31m);[m

   [01;34mprocedure[m [01;30mAssign_Keystroke[m [31m([m [31m-- idem[m
			       Stream       [31m:[m [01;34min[m Stream_Type[31m;[m
			       Key          [31m:[m [01;34min[m Key_Type[31m;[m
			       Modifier_Key [31m:[m [01;34min[m Modifier_Key_Type[31m;[m
			       Substitution [31m:[m [01;34min[m [32mWide_String[m[31m);[m



[01;34mend[m Sky[31m.[mAnsi[31m.[mConsole [31m;[m 
