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

[01;34mpackage[m [01;34mbody[m M[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-- Please : be sure your have read the specification before you read[m
[31m-- the implementation.[m
[31m--[m
[31m-- Saturday, November 25 - 2006 - france (somewhere in europe ...)[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	This implementation depends on values of[m
	[31m-- 	Maximum_Screen_Height and Maximum_Screen_Width. From those value,[m
	[31m-- 	is deduced the maximum string length represented the corresponding[m
	[31m-- 	value in decimal. Actualy, with this implementation, maximum length[m
	[31m-- 	of both is 4. And maximum length for other decimal strings is 2. So[m
	[31m-- 	the longest is 4.[m
	[31m-- o	Output is first prepared in a small buffer, before being sent to[m
	[31m-- 	the output stream. Buffers are local to procedures, so tis way[m
	[31m-- 	the package is reentrant.[m

	[31m-- =========================================================================[m
	[31m-- Organisation of this implementation[m
	[31m-- -------------------------------------------------------------------------[m
	[31m-- O Command buffer[m
	[31m-- o		Type and constantes for buffer size[m
	[31m-- o		Type for buffer content[m
	[31m-- o		Buffer[m
	[31m-- o		Buffer initialisation and appending[m
	[31m-- o		Procedures to send the buffer content to the output stream[m
	[31m-- O Text output and erasing of screen[m
	[31m-- o		Simply text output procedures (provided for consistency).[m
	[31m-- o		Simply character output procedures (provided for consistency).[m
	[31m-- o		Simply character input procedures (provided for consistency).[m
	[31m-- o		Procedures for clearing screen or part of line.[m
	[31m-- O Text color and attributes[m
	[31m-- o		Procedures for setting text color.[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		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		Procedures for fixing screen mode (screen resolution)[m
	[31m-- o		Procedures for fixing screen behaviour (line wrapping)[m
	[31m-- O Keystroke assignements[m
	[31m-- o		Function for keystroke string code[m
	[31m-- o		Procedure for assigning key-stroke to string[m

	[31m-- =========================================================================[m
	[31m-- Command buffer[m
	[31m-- -------------------------------------------------------------------------[m

	[31m-- Type and constantes for buffer size[m
	[31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

	[31m-- Maximum buffered string length is 12 (see length details in each[m
	[31m-- procedure).[m
   Maximum_Buffered_Length [31m:[m [01;34mconstant[m Positive [31m:=[m [35m12[m[31m;[m

	[01;34msubtype[m Buffer_Count_Type [01;34mis[m Natural [01;34mrange[m [35m0[m[31m..[mMaximum_Buffered_Length[31m;[m

	[01;34msubtype[m Buffer_Index_Type [01;34mis[m Buffer_Count_Type
		[01;34mrange[m [35m1[m[31m..[mBuffer_Count_Type'Last[31m;[m

	[31m-- Type for buffer content[m
	[31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

	[01;34msubtype[m Buffer_Content_Type [01;34mis[m [32mWide_String[m [31m([mBuffer_Index_Type[31m);[m
	
	[31m-- Buffer[m
	[31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

	[01;34mtype[m Buffer_Type [01;34mis[m
	[01;34mrecord[m
	   Count   [31m:[m Buffer_Count_Type [31m:=[m [35m0[m[31m;[m [31m-- Always initialy empty.[m
	   Content [31m:[m Buffer_Content_Type[31m;[m
	[01;34mend[m [01;34mrecord[m[31m;[m

	[31m-- Buffer initialisation and appending[m
	[31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

	[01;34mprocedure[m [01;30mStart[m [31m([mBuffer [31m:[m [01;34mout[m Buffer_Type[31m)[m
	[01;34mis[m
	[01;34mbegin[m
		Buffer[31m.[mCount [31m:=[m [35m2[m[31m;[m
		Buffer[31m.[m[01;30mContent[m [31m([m[35m1[m[31m)[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m27[m[31m);[m
		Buffer[31m.[m[01;30mContent[m [31m([m[35m2[m[31m)[m [31m:=[m [31m'['[m[31m;[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mAppend[m [31m([mBuffer [31m:[m [01;34min[m [01;34mout[m Buffer_Type[31m;[m C [31m:[m [01;34min[m Wide_Character[31m)[m
	[01;34mis[m
	[01;34mbegin[m
		Buffer[31m.[mCount [31m:=[m Buffer[31m.[mCount [31m+[m [35m1[m[31m;[m
		Buffer[31m.[m[01;30mContent[m [31m([mBuffer[31m.[mCount[31m)[m [31m:=[m C[31m;[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mAppend[m [31m([mBuffer [31m:[m [01;34min[m [01;34mout[m Buffer_Type[31m;[m S [31m:[m [01;34min[m [32mWide_String[m[31m)[m
	[01;34mis[m
		i [31m:[m Buffer_Index_Type[31m;[m
		j [31m:[m Buffer_Index_Type[31m;[m
	[01;34mbegin[m
		i [31m:=[m Buffer[31m.[mCount [31m+[m [35m1[m[31m;[m
		j [31m:=[m Buffer[31m.[mCount [31m+[m S[31m'Length; -- i.e. same as (i - 1) + S'[mLength
		Buffer[31m.[m[01;30mContent[m [31m([mi[31m..[mj[31m)[m [31m:=[m S[31m;[m
		Buffer[31m.[mCount [31m:=[m Buffer[31m.[mCount [31m+[m S'Length[31m;[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mAppend[m [31m([mBuffer [31m:[m [01;34min[m [01;34mout[m Buffer_Type[31m;[m N [31m:[m [01;34min[m Natural[31m)[m
	[01;34mis[m
		E [31m:[m Natural[31m;[m [31m-- Expression - to work on a copy of N.[m
	[01;34mbegin[m
		[31m-- The fastest code ...[m
		[31m-- 48 is the ASCII code for the character '0' (zero).[m
		[01;34mif[m N [31m<=[m [35m9[m [01;34mthen[m
			Buffer[31m.[mCount [31m:=[m Buffer[31m.[mCount [31m+[m [35m1[m[31m;[m
			Buffer[31m.[m[01;30mContent[m [31m([mBuffer[31m.[mCount[31m)[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m48[m [31m+[m N[31m);[m
		[01;34melsif[m N [31m<=[m [35m99[m [01;34mthen[m
			Buffer[31m.[m[01;30mContent[m [31m([mBuffer[31m.[mCount [31m+[m [35m1[m[31m)[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m48[m [31m+[m N [31m/[m [35m10[m[31m);[m
			Buffer[31m.[m[01;30mContent[m [31m([mBuffer[31m.[mCount [31m+[m [35m2[m[31m)[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m48[m [31m+[m N [01;34mrem[m [35m10[m[31m);[m
			Buffer[31m.[mCount [31m:=[m Buffer[31m.[mCount [31m+[m [35m2[m[31m;[m
		[01;34melsif[m N [31m<=[m [35m999[m [01;34mthen[m
			E [31m:=[m N[31m;[m
			Buffer[31m.[m[01;30mContent[m [31m([mBuffer[31m.[mCount [31m+[m [35m3[m[31m)[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m48[m [31m+[m E [01;34mrem[m [35m10[m[31m);[m
			E [31m:=[m E [31m/[m [35m10[m[31m;[m
			Buffer[31m.[m[01;30mContent[m [31m([mBuffer[31m.[mCount [31m+[m [35m2[m[31m)[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m48[m [31m+[m E [01;34mrem[m [35m10[m[31m);[m
			Buffer[31m.[m[01;30mContent[m [31m([mBuffer[31m.[mCount [31m+[m [35m1[m[31m)[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m48[m [31m+[m E [31m/[m [35m10[m[31m);[m
			Buffer[31m.[mCount [31m:=[m Buffer[31m.[mCount [31m+[m [35m3[m[31m;[m
		[01;34melse[m
			E [31m:=[m N[31m;[m
			Buffer[31m.[m[01;30mContent[m [31m([mBuffer[31m.[mCount [31m+[m [35m4[m[31m)[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m48[m [31m+[m E [01;34mrem[m [35m10[m[31m);[m
			E [31m:=[m E [31m/[m [35m10[m[31m;[m
			Buffer[31m.[m[01;30mContent[m [31m([mBuffer[31m.[mCount [31m+[m [35m3[m[31m)[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m48[m [31m+[m E [01;34mrem[m [35m10[m[31m);[m
			E [31m:=[m E [31m/[m [35m10[m[31m;[m
			Buffer[31m.[m[01;30mContent[m [31m([mBuffer[31m.[mCount [31m+[m [35m2[m[31m)[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m48[m [31m+[m E [01;34mrem[m [35m10[m[31m);[m
			Buffer[31m.[m[01;30mContent[m [31m([mBuffer[31m.[mCount [31m+[m [35m1[m[31m)[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m48[m [31m+[m E [31m/[m [35m10[m[31m);[m
			Buffer[31m.[mCount [31m:=[m Buffer[31m.[mCount [31m+[m [35m4[m[31m;[m
		[01;34mend[m [01;34mif[m[31m;[m
	[01;34mend[m[31m;[m

	[31m-- Procedures to send the buffer content to the output stream[m
	[31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

	[31m-- Constant command strings are sent directly using Put_Command_String,[m
	[31m-- bypassing Put via Buffer.[m

	[01;34mprocedure[m [01;30mPut_Command_String[m [31m([mS [31m:[m [01;34min[m [32mWide_String[m[31m)[m [01;34mrenames[m Ada[31m.[mWide_Text_IO[31m.[mPut[31m;[m

	[01;34mprocedure[m [01;30mPut_Command_String[m [31m([m
		Stream [31m:[m [01;34min[m Stream_Type[31m;[m
		S      [31m:[m [01;34min[m [32mWide_String[m[31m)[m
	  [01;34mrenames[m Ada[31m.[mWide_Text_IO[31m.[mPut[31m;[m

	[01;34mprocedure[m [01;30mPut[m [31m([mBuffer [31m:[m [01;34min[m Buffer_Type[31m)[m
	[01;34mis[m
	[01;34mbegin[m
		[01;30mPut_Command_String[m [31m([mBuffer[31m.[m[01;30mContent[m [31m([mBuffer[31m.[mContent'First[31m..[mBuffer[31m.[mCount[31m));[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mPut[m [31m([mStream [31m:[m [01;34min[m Stream_Type[31m;[m Buffer [31m:[m [01;34min[m Buffer_Type[31m)[m
	[01;34mis[m
	[01;34mbegin[m
		[01;30mPut_Command_String[m [31m([m
			Stream[31m,[m
			Buffer[31m.[m[01;30mContent[m [31m([mBuffer[31m.[mContent'First[31m..[mBuffer[31m.[mCount[31m));[m
	[01;34mend[m[31m;[m

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

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

	[01;34mprocedure[m [01;30mPut[m [31m([mText [31m:[m [01;34min[m [32mWide_String[m[31m)[m [01;34mrenames[m Ada[31m.[mWide_Text_IO[31m.[mPut[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;34mrenames[m Ada[31m.[mWide_Text_IO[31m.[mPut[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;34mis[m
	[01;34mbegin[m
		[01;30mMove_Cursor_To[m [31m([mLine[31m,[m Column[31m);[m
		Ada[31m.[mWide_Text_IO[31m.[m[01;30mPut[m [31m([mText[31m);[m
	[01;34mend[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
	[01;34mis[m
	[01;34mbegin[m
		[01;30mMove_Cursor_To[m [31m([mLine[31m,[m Column[31m);[m
		Ada[31m.[mWide_Text_IO[31m.[m[01;30mPut[m [31m([mStream[31m,[m Text[31m);[m
	[01;34mend[m[31m;[m

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

	[01;34mprocedure[m [01;30mPut[m [31m([mC [31m:[m [01;34min[m Wide_Character[31m)[m [01;34mrenames[m Ada[31m.[mWide_Text_IO[31m.[mPut[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;34mrenames[m Ada[31m.[mWide_Text_IO[31m.[mPut[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;34mis[m
	[01;34mbegin[m
		[01;30mMove_Cursor_To[m [31m([mLine[31m,[m Column[31m);[m
		Ada[31m.[mWide_Text_IO[31m.[m[01;30mPut[m [31m([mC[31m);[m
	[01;34mend[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
		C      [31m:[m [01;34min[m Wide_Character[31m)[m
	[01;34mis[m
	[01;34mbegin[m
		[01;30mMove_Cursor_To[m [31m([mLine[31m,[m Column[31m);[m
		Ada[31m.[mWide_Text_IO[31m.[m[01;30mPut[m [31m([mStream[31m,[m C[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m Beep [01;34mis[m
	[01;34mbegin[m
		[01;30mPut[m [31m([mWide_Character'[01;30mVal[m[31m([m[35m7[m[31m));[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mBeep[m [31m([mStream [31m:[m [01;34min[m Stream_Type[31m)[m [01;34mis[m
	[01;34mbegin[m
		[01;30mPut[m [31m([mStream[31m,[m Wide_Character'[01;30mVal[m[31m([m[35m7[m[31m));[m
	[01;34mend[m[31m;[m

	[31m-- Simply character input procedures (provided for consistency).[m
	[31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m
	[01;34mprocedure[m [01;30mGet[m [31m([mC [31m:[m [01;34mout[m Wide_Character[31m)[m [01;34mrenames[m Ada[31m.[mWide_Text_IO[31m.[mGet[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;34mrenames[m Ada[31m.[mWide_Text_IO[31m.[mGet[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;34mrenames[m Ada[31m.[mWide_Text_IO[31m.[mGet_Immediate[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
	[01;34mrenames[m Ada[31m.[mWide_Text_IO[31m.[mGet_Immediate[31m;[m

	[01;34mprocedure[m [01;30mDecode_Key_With_Prefix_0[m [31m([m
		Input        [31m:[m [01;34min[m Wide_Character[31m;[m
		Key          [31m:[m [01;34mout[m Key_Type[31m;[m
		Modifier_Key [31m:[m [01;34mout[m Modifier_Key_Type[31m;[m
		Ok           [31m:[m [01;34mout[m [32mBoolean[m[31m)[m
	[01;34mis[m
	[01;34mbegin[m
		[31m-- This line factorised here[m
		Ok [31m:=[m True[31m;[m
		[31m-- Start of job[m
		[01;34mcase[m Wide_Character'[01;30mPos[m[31m([mInput[31m)[m [01;34mis[m
		[31m-- Codes indicating no modifier key[m
		[01;34mwhen[m  [35m59[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_F1[31m;[m
		[01;34mwhen[m  [35m60[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_F2[31m;[m
		[01;34mwhen[m  [35m61[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_F3[31m;[m
		[01;34mwhen[m  [35m62[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_F4[31m;[m
		[01;34mwhen[m  [35m63[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_F5[31m;[m
		[01;34mwhen[m  [35m64[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_F6[31m;[m
		[01;34mwhen[m  [35m65[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_F7[31m;[m
		[01;34mwhen[m  [35m66[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_F8[31m;[m
		[01;34mwhen[m  [35m67[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_F9[31m;[m
		[01;34mwhen[m  [35m68[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_F10[31m;[m
		[01;34mwhen[m  [35m71[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Keypad_Home[31m;[m
		[01;34mwhen[m  [35m72[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Keypad_Up_Arrow[31m;[m
		[01;34mwhen[m  [35m73[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Keypad_Page_Up[31m;[m
		[01;34mwhen[m  [35m75[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Keypad_Left_Arrow[31m;[m
		[01;34mwhen[m  [35m77[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Keypad_Right_Arrow[31m;[m
		[01;34mwhen[m  [35m79[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Keypad_End[31m;[m
		[01;34mwhen[m  [35m80[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Keypad_Down_Arrow[31m;[m
		[01;34mwhen[m  [35m81[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Keypad_Page_Down[31m;[m
		[01;34mwhen[m  [35m82[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Keypad_Insert[31m;[m
		[01;34mwhen[m  [35m83[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Keypad_Delete[31m;[m
		[31m-- This two ones normally start with prefix 224,[m
		[31m-- but may start with prefix 0 on some systems.[m
		[01;34mwhen[m [35m133[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_F11[31m;[m
		[01;34mwhen[m [35m134[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_F12[31m;[m
		[31m-- Codes indicating ALT[m
		[01;34mwhen[m [35m104[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_F1[31m;[m
		[01;34mwhen[m [35m105[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_F2[31m;[m
		[01;34mwhen[m [35m106[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_F3[31m;[m
		[01;34mwhen[m [35m107[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_F4[31m;[m
		[01;34mwhen[m [35m108[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_F5[31m;[m
		[01;34mwhen[m [35m109[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_F6[31m;[m
		[01;34mwhen[m [35m110[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_F7[31m;[m
		[01;34mwhen[m [35m111[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_F8[31m;[m
		[01;34mwhen[m [35m112[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_F9[31m;[m
		[01;34mwhen[m [35m113[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_F10[31m;[m
		[01;34mwhen[m [35m151[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_Home[31m;[m
		[01;34mwhen[m [35m152[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_Up_Arrow[31m;[m
		[01;34mwhen[m [35m153[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_Page_Up[31m;[m
		[01;34mwhen[m [35m155[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_Left_Arrow[31m;[m
		[01;34mwhen[m [35m157[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_Right_Arrow[31m;[m
		[01;34mwhen[m [35m159[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_End[31m;[m
		[01;34mwhen[m [35m160[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_Down_Arrow[31m;[m
		[01;34mwhen[m [35m161[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_Page_Down[31m;[m
		[01;34mwhen[m [35m162[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_Insert[31m;[m
		[01;34mwhen[m [35m163[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_Delete[31m;[m
		[31m-- Codes indicating CTRL[m
		[01;34mwhen[m  [35m94[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_F1[31m;[m
		[01;34mwhen[m  [35m95[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_F2[31m;[m
		[01;34mwhen[m  [35m96[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_F3[31m;[m
		[01;34mwhen[m  [35m97[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_F4[31m;[m
		[01;34mwhen[m  [35m98[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_F5[31m;[m
		[01;34mwhen[m  [35m99[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_F6[31m;[m
		[01;34mwhen[m [35m100[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_F7[31m;[m
		[01;34mwhen[m [35m101[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_F8[31m;[m
		[01;34mwhen[m [35m102[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_F9[31m;[m
		[01;34mwhen[m [35m103[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_F10[31m;[m
		[01;34mwhen[m [35m119[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Keypad_Home[31m;[m
		[01;34mwhen[m [35m141[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Keypad_Up_Arrow[31m;[m
		[01;34mwhen[m [35m132[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Keypad_Page_Up[31m;[m
		[01;34mwhen[m [35m115[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Keypad_Left_Arrow[31m;[m
		[01;34mwhen[m [35m116[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Keypad_Right_Arrow[31m;[m
		[01;34mwhen[m [35m117[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Keypad_End[31m;[m
		[01;34mwhen[m [35m145[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Keypad_Down_Arrow[31m;[m
		[01;34mwhen[m [35m118[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Keypad_Page_Down[31m;[m
		[01;34mwhen[m [35m146[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Keypad_Insert[31m;[m
		[01;34mwhen[m [35m147[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Keypad_Delete[31m;[m
		[01;34mwhen[m [35m148[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_Tab[31m;[m
		[31m-- Codes indicating SHIFT[m
		[01;34mwhen[m  [35m84[m [31m=>[m
			Modifier_Key [31m:=[m Shift_Key[31m;[m
			Key [31m:=[m Key_F1[31m;[m
		[01;34mwhen[m  [35m85[m [31m=>[m
			Modifier_Key [31m:=[m Shift_Key[31m;[m
			Key [31m:=[m Key_F2[31m;[m
		[01;34mwhen[m  [35m86[m [31m=>[m
			Modifier_Key [31m:=[m Shift_Key[31m;[m
			Key [31m:=[m Key_F3[31m;[m
		[01;34mwhen[m  [35m87[m [31m=>[m
			Modifier_Key [31m:=[m Shift_Key[31m;[m
			Key [31m:=[m Key_F4[31m;[m
		[01;34mwhen[m  [35m88[m [31m=>[m
			Modifier_Key [31m:=[m Shift_Key[31m;[m
			Key [31m:=[m Key_F5[31m;[m
		[01;34mwhen[m  [35m89[m [31m=>[m
			Modifier_Key [31m:=[m Shift_Key[31m;[m
			Key [31m:=[m Key_F6[31m;[m
		[01;34mwhen[m  [35m90[m [31m=>[m
			Modifier_Key [31m:=[m Shift_Key[31m;[m
			Key [31m:=[m Key_F7[31m;[m
		[01;34mwhen[m  [35m91[m [31m=>[m
			Modifier_Key [31m:=[m Shift_Key[31m;[m
			Key [31m:=[m Key_F8[31m;[m
		[01;34mwhen[m  [35m92[m [31m=>[m
			Modifier_Key [31m:=[m Shift_Key[31m;[m
			Key [31m:=[m Key_F9[31m;[m
		[01;34mwhen[m  [35m93[m [31m=>[m
			Modifier_Key [31m:=[m Shift_Key[31m;[m
			Key [31m:=[m Key_F10[31m;[m
		[31m-- Nothing[m
		[01;34mwhen[m [01;34mothers[m [31m=>[m Ok [31m:=[m False[31m;[m
		[01;34mend[m [01;34mcase[m[31m;[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mDecode_Key_With_Prefix_224[m [31m([m
		Input        [31m:[m [01;34min[m Wide_Character[31m;[m
		Key          [31m:[m [01;34mout[m Key_Type[31m;[m
		Modifier_Key [31m:[m [01;34mout[m Modifier_Key_Type[31m;[m
		Ok           [31m:[m [01;34mout[m [32mBoolean[m[31m)[m
	[01;34mis[m
	[01;34mbegin[m
		[31m-- This line factorised here[m
		Ok [31m:=[m True[31m;[m
		[31m-- Start of job[m
		[01;34mcase[m Wide_Character'[01;30mPos[m[31m([mInput[31m)[m [01;34mis[m
		[31m-- Codes indicating no modifier key[m
		[01;34mwhen[m [35m133[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_F11[31m;[m
		[01;34mwhen[m [35m134[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_F12[31m;[m
		[01;34mwhen[m  [35m71[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_Home[31m;[m
		[01;34mwhen[m  [35m72[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_Up_Arrow[31m;[m
		[01;34mwhen[m  [35m73[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_Page_Up[31m;[m
		[01;34mwhen[m  [35m75[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_Left_Arrow[31m;[m
		[01;34mwhen[m  [35m77[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_Right_Arrow[31m;[m
		[01;34mwhen[m  [35m79[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_End[31m;[m
		[01;34mwhen[m  [35m80[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_Down_Arrow[31m;[m
		[01;34mwhen[m  [35m81[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_Page_Down[31m;[m
		[01;34mwhen[m  [35m82[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_Insert[31m;[m
		[01;34mwhen[m  [35m83[m [31m=>[m
			Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
			Key [31m:=[m Key_Delete[31m;[m
		[31m-- Codes indicating ALT[m
		[01;34mwhen[m [35m139[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_F11[31m;[m
		[01;34mwhen[m [35m140[m [31m=>[m
			Modifier_Key [31m:=[m Alt_Key[31m;[m
			Key [31m:=[m Key_F12[31m;[m
		[31m-- Codes indicating CTRL[m
		[01;34mwhen[m [35m137[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_F11[31m;[m
		[01;34mwhen[m [35m138[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_F12[31m;[m
		[01;34mwhen[m [35m119[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_Home[31m;[m
		[01;34mwhen[m [35m141[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_Up_Arrow[31m;[m
		[31m-- Same code as F12[m
		[31m--when 134 =>[m
		[31m--	Modifier_Key := Ctrl_Key;[m
		[31m--	Key := Key_Page_Up;[m
		[01;34mwhen[m [35m115[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_Left_Arrow[31m;[m
		[01;34mwhen[m [35m116[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_Right_Arrow[31m;[m
		[01;34mwhen[m [35m117[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_End[31m;[m
		[01;34mwhen[m [35m145[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_Down_Arrow[31m;[m
		[01;34mwhen[m [35m118[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_Page_Down[31m;[m
		[01;34mwhen[m [35m146[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_Insert[31m;[m
		[01;34mwhen[m [35m147[m [31m=>[m
			Modifier_Key [31m:=[m Ctrl_Key[31m;[m
			Key [31m:=[m Key_Delete[31m;[m
		[31m-- Codes indicating SHIFT[m
		[01;34mwhen[m [35m135[m [31m=>[m
			Modifier_Key [31m:=[m Shift_Key[31m;[m
			Key [31m:=[m Key_F11[31m;[m
		[01;34mwhen[m [35m136[m [31m=>[m
			Modifier_Key [31m:=[m Shift_Key[31m;[m
			Key [31m:=[m Key_F12[31m;[m
		[31m-- Nothing[m
		[01;34mwhen[m [01;34mothers[m [31m=>[m Ok [31m:=[m False[31m;[m
		[01;34mend[m [01;34mcase[m[31m;[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mDecode_Key_With_No_Prefix[m [31m([m
		Input        [31m:[m [01;34min[m Wide_Character[31m;[m
		Key          [31m:[m [01;34mout[m Key_Type[31m;[m
		Modifier_Key [31m:[m [01;34mout[m Modifier_Key_Type[31m;[m
		Ok           [31m:[m [01;34mout[m [32mBoolean[m[31m)[m
	[01;34mis[m
	[01;34mbegin[m
		[31m-- This line is factorised here[m
		Ok [31m:=[m True[31m;[m
		Modifier_Key [31m:=[m No_Modifier_Key[31m;[m
		[31m-- Start of job[m
		[01;34mcase[m Wide_Character'[01;30mPos[m[31m([mInput[31m)[m [01;34mis[m
		[01;34mwhen[m   [35m8[m [31m=>[m Key [31m:=[m Key_Backspace[31m;[m
		[01;34mwhen[m   [35m9[m [31m=>[m Key [31m:=[m Key_Tab[31m;[m
		[01;34mwhen[m  [35m13[m [31m=>[m Key [31m:=[m Key_Enter[31m;[m
		[01;34mwhen[m  [35m27[m [31m=>[m Key [31m:=[m Key_Escape[31m;[m
		[01;34mwhen[m  [35m32[m [31m=>[m Key [31m:=[m Key_Space[31m;[m
		[01;34mwhen[m  [35m48[m [31m=>[m Key [31m:=[m Key_0[31m;[m
		[01;34mwhen[m  [35m49[m [31m=>[m Key [31m:=[m Key_1[31m;[m
		[01;34mwhen[m  [35m50[m [31m=>[m Key [31m:=[m Key_2[31m;[m
		[01;34mwhen[m  [35m51[m [31m=>[m Key [31m:=[m Key_3[31m;[m
		[01;34mwhen[m  [35m52[m [31m=>[m Key [31m:=[m Key_4[31m;[m
		[01;34mwhen[m  [35m53[m [31m=>[m Key [31m:=[m Key_5[31m;[m
		[01;34mwhen[m  [35m54[m [31m=>[m Key [31m:=[m Key_6[31m;[m
		[01;34mwhen[m  [35m55[m [31m=>[m Key [31m:=[m Key_7[31m;[m
		[01;34mwhen[m  [35m56[m [31m=>[m Key [31m:=[m Key_8[31m;[m
		[01;34mwhen[m  [35m57[m [31m=>[m Key [31m:=[m Key_9[31m;[m
		[01;34mwhen[m  [35m65[m [31m=>[m Key [31m:=[m Key_A[31m;[m
		[01;34mwhen[m  [35m66[m [31m=>[m Key [31m:=[m Key_B[31m;[m
		[01;34mwhen[m  [35m67[m [31m=>[m Key [31m:=[m Key_C[31m;[m
		[01;34mwhen[m  [35m68[m [31m=>[m Key [31m:=[m Key_D[31m;[m
		[01;34mwhen[m  [35m69[m [31m=>[m Key [31m:=[m Key_E[31m;[m
		[01;34mwhen[m  [35m70[m [31m=>[m Key [31m:=[m Key_F[31m;[m
		[01;34mwhen[m  [35m71[m [31m=>[m Key [31m:=[m Key_G[31m;[m
		[01;34mwhen[m  [35m72[m [31m=>[m Key [31m:=[m Key_H[31m;[m
		[01;34mwhen[m  [35m73[m [31m=>[m Key [31m:=[m Key_I[31m;[m
		[01;34mwhen[m  [35m74[m [31m=>[m Key [31m:=[m Key_J[31m;[m
		[01;34mwhen[m  [35m75[m [31m=>[m Key [31m:=[m Key_K[31m;[m
		[01;34mwhen[m  [35m76[m [31m=>[m Key [31m:=[m Key_L[31m;[m
		[01;34mwhen[m  [35m77[m [31m=>[m Key [31m:=[m Key_M[31m;[m
		[01;34mwhen[m  [35m78[m [31m=>[m Key [31m:=[m Key_N[31m;[m
		[01;34mwhen[m  [35m79[m [31m=>[m Key [31m:=[m Key_O[31m;[m
		[01;34mwhen[m  [35m80[m [31m=>[m Key [31m:=[m Key_P[31m;[m
		[01;34mwhen[m  [35m81[m [31m=>[m Key [31m:=[m Key_Q[31m;[m
		[01;34mwhen[m  [35m82[m [31m=>[m Key [31m:=[m Key_R[31m;[m
		[01;34mwhen[m  [35m83[m [31m=>[m Key [31m:=[m Key_S[31m;[m
		[01;34mwhen[m  [35m84[m [31m=>[m Key [31m:=[m Key_T[31m;[m
		[01;34mwhen[m  [35m85[m [31m=>[m Key [31m:=[m Key_U[31m;[m
		[01;34mwhen[m  [35m86[m [31m=>[m Key [31m:=[m Key_V[31m;[m
		[01;34mwhen[m  [35m87[m [31m=>[m Key [31m:=[m Key_W[31m;[m
		[01;34mwhen[m  [35m88[m [31m=>[m Key [31m:=[m Key_X[31m;[m
		[01;34mwhen[m  [35m89[m [31m=>[m Key [31m:=[m Key_Y[31m;[m
		[01;34mwhen[m  [35m90[m [31m=>[m Key [31m:=[m Key_Z[31m;[m
		[01;34mwhen[m  [35m97[m [31m=>[m Key [31m:=[m Key_A[31m;[m
		[01;34mwhen[m  [35m98[m [31m=>[m Key [31m:=[m Key_B[31m;[m
		[01;34mwhen[m  [35m99[m [31m=>[m Key [31m:=[m Key_C[31m;[m
		[01;34mwhen[m [35m100[m [31m=>[m Key [31m:=[m Key_D[31m;[m
		[01;34mwhen[m [35m101[m [31m=>[m Key [31m:=[m Key_E[31m;[m
		[01;34mwhen[m [35m102[m [31m=>[m Key [31m:=[m Key_F[31m;[m
		[01;34mwhen[m [35m103[m [31m=>[m Key [31m:=[m Key_G[31m;[m
		[01;34mwhen[m [35m104[m [31m=>[m Key [31m:=[m Key_H[31m;[m
		[01;34mwhen[m [35m105[m [31m=>[m Key [31m:=[m Key_I[31m;[m
		[01;34mwhen[m [35m106[m [31m=>[m Key [31m:=[m Key_J[31m;[m
		[01;34mwhen[m [35m107[m [31m=>[m Key [31m:=[m Key_K[31m;[m
		[01;34mwhen[m [35m108[m [31m=>[m Key [31m:=[m Key_L[31m;[m
		[01;34mwhen[m [35m109[m [31m=>[m Key [31m:=[m Key_M[31m;[m
		[01;34mwhen[m [35m110[m [31m=>[m Key [31m:=[m Key_N[31m;[m
		[01;34mwhen[m [35m111[m [31m=>[m Key [31m:=[m Key_O[31m;[m
		[01;34mwhen[m [35m112[m [31m=>[m Key [31m:=[m Key_P[31m;[m
		[01;34mwhen[m [35m113[m [31m=>[m Key [31m:=[m Key_Q[31m;[m
		[01;34mwhen[m [35m114[m [31m=>[m Key [31m:=[m Key_R[31m;[m
		[01;34mwhen[m [35m115[m [31m=>[m Key [31m:=[m Key_S[31m;[m
		[01;34mwhen[m [35m116[m [31m=>[m Key [31m:=[m Key_T[31m;[m
		[01;34mwhen[m [35m117[m [31m=>[m Key [31m:=[m Key_U[31m;[m
		[01;34mwhen[m [35m118[m [31m=>[m Key [31m:=[m Key_V[31m;[m
		[01;34mwhen[m [35m119[m [31m=>[m Key [31m:=[m Key_W[31m;[m
		[01;34mwhen[m [35m120[m [31m=>[m Key [31m:=[m Key_X[31m;[m
		[01;34mwhen[m [35m121[m [31m=>[m Key [31m:=[m Key_Y[31m;[m
		[01;34mwhen[m [35m122[m [31m=>[m Key [31m:=[m Key_Z[31m;[m
		[01;34mwhen[m [01;34mothers[m [31m=>[m Ok [31m:=[m False[31m;[m
		[01;34mend[m [01;34mcase[m[31m;[m
	[01;34mend[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;34mis[m
		Input     [31m:[m Wide_Character[31m;[m
		Available [31m:[m [32mBoolean[m[31m;[m
	[01;34mbegin[m
		[31m-- This two lines are factorised here.[m
		Keystroke_Input[31m.[mKey_Available [31m:=[m False[31m;[m
		Keystroke_Input[31m.[mCharacter_Available [31m:=[m False[31m;[m
		[31m-- Start of job[m
		[01;30mGet[m [31m([mInput[31m,[m Available[31m);[m
		[01;34mif[m [01;34mnot[m Available [01;34mthen[m
			[01;34mreturn[m[31m;[m
		[01;34mend[m [01;34mif[m[31m;[m
		[01;34mcase[m Wide_Character'[01;30mPos[m [31m([mInput[31m)[m [01;34mis[m
		[01;34mwhen[m [35m0[m [31m=>[m
			[01;30mGet[m [31m([mInput[31m,[m Available[31m);[m
			[01;34mif[m [01;34mnot[m Available [01;34mthen[m [31m-- Should we notify an error ?.[m
				[01;34mreturn[m[31m;[m
			[01;34mend[m [01;34mif[m[31m;[m
			[31m-- Should we notify an error when no key was decoded ?[m
			[01;30mDecode_Key_With_Prefix_0[m [31m([m
				Input[31m,[m
				Keystroke_Input[31m.[mKey[31m,[m
				Keystroke_Input[31m.[mModifier_Key[31m,[m
				Keystroke_Input[31m.[mKey_Available[31m);[m
		[01;34mwhen[m [35m224[m [31m=>[m
			[01;30mGet[m [31m([mInput[31m,[m Available[31m);[m
			[01;34mif[m [01;34mnot[m Available [01;34mthen[m [31m-- Should we notify an error ?.[m
				[01;34mreturn[m[31m;[m
			[01;34mend[m [01;34mif[m[31m;[m
			[31m-- Should we notify an error when no key was decoded ?[m
			[01;30mDecode_Key_With_Prefix_224[m [31m([m
				Input[31m,[m
				Keystroke_Input[31m.[mKey[31m,[m
				Keystroke_Input[31m.[mModifier_Key[31m,[m
				Keystroke_Input[31m.[mKey_Available[31m);[m
		[01;34mwhen[m [35m240[m [31m=>[m
			[31m-- This a special case, the only one of this kind.[m
			[31m-- Cannot be interpreted... seems to be an error code[m
			[31m-- or a placeholder.[m
			[01;34mreturn[m[31m;[m
		[01;34mwhen[m [01;34mothers[m [31m=>[m
			Keystroke_Input[31m.[mC [31m:=[m Input[31m;[m
			Keystroke_Input[31m.[mCharacter_Available [31m:=[m True[31m;[m
			[01;30mDecode_Key_With_No_Prefix[m [31m([m
				Input[31m,[m
				Keystroke_Input[31m.[mKey[31m,[m
				Keystroke_Input[31m.[mModifier_Key[31m,[m
				Keystroke_Input[31m.[mKey_Available[31m);[m
		[01;34mend[m [01;34mcase[m[31m;[m
	[01;34mend[m[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
	[01;34mis[m
		Input     [31m:[m Wide_Character[31m;[m
		Available [31m:[m [32mBoolean[m[31m;[m
	[01;34mbegin[m
		[31m-- This two lines are factorised here.[m
		Keystroke_Input[31m.[mKey_Available [31m:=[m False[31m;[m
		Keystroke_Input[31m.[mCharacter_Available [31m:=[m False[31m;[m
		[31m-- Start of job[m
		[01;30mGet[m [31m([mStream[31m,[m Input[31m,[m Available[31m);[m
		[01;34mif[m [01;34mnot[m Available [01;34mthen[m
			[01;34mreturn[m[31m;[m
		[01;34mend[m [01;34mif[m[31m;[m
		[01;34mcase[m Wide_Character'[01;30mPos[m [31m([mInput[31m)[m [01;34mis[m
		[01;34mwhen[m [35m0[m [31m=>[m
			[01;30mGet[m [31m([mStream[31m,[m Input[31m,[m Available[31m);[m
			[01;34mif[m [01;34mnot[m Available [01;34mthen[m [31m-- Should we notify an error ?.[m
				[01;34mreturn[m[31m;[m
			[01;34mend[m [01;34mif[m[31m;[m
			[31m-- Should we notify an error when no key was decoded ?[m
			[01;30mDecode_Key_With_Prefix_0[m [31m([m
				Input[31m,[m
				Keystroke_Input[31m.[mKey[31m,[m
				Keystroke_Input[31m.[mModifier_Key[31m,[m
				Keystroke_Input[31m.[mKey_Available[31m);[m
		[01;34mwhen[m [35m224[m [31m=>[m
			[01;30mGet[m [31m([mStream[31m,[m Input[31m,[m Available[31m);[m
			[01;34mif[m [01;34mnot[m Available [01;34mthen[m [31m-- Should we notify an error ?.[m
				[01;34mreturn[m[31m;[m
			[01;34mend[m [01;34mif[m[31m;[m
			[31m-- Should we notify an error when no key was decoded ?[m
			[01;30mDecode_Key_With_Prefix_224[m [31m([m
				Input[31m,[m
				Keystroke_Input[31m.[mKey[31m,[m
				Keystroke_Input[31m.[mModifier_Key[31m,[m
				Keystroke_Input[31m.[mKey_Available[31m);[m
		[01;34mwhen[m [35m240[m [31m=>[m
			[31m-- This a special case, the only one of this kind.[m
			[31m-- Cannot be interpreted... seems to be an error code[m
			[31m-- or a placeholder.[m
			[01;34mreturn[m[31m;[m
		[01;34mwhen[m [01;34mothers[m [31m=>[m
			Keystroke_Input[31m.[mC [31m:=[m Input[31m;[m
			Keystroke_Input[31m.[mCharacter_Available [31m:=[m True[31m;[m
			[01;30mDecode_Key_With_No_Prefix[m [31m([m
				Input[31m,[m
				Keystroke_Input[31m.[mKey[31m,[m
				Keystroke_Input[31m.[mModifier_Key[31m,[m
				Keystroke_Input[31m.[mKey_Available[31m);[m
		[01;34mend[m [01;34mcase[m[31m;[m
	[01;34mend[m[31m;[m

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

	[01;34mprocedure[m Clear_Screen [31m-- Implements ESC[2J[m
	[01;34mis[m
		S [31m:[m [01;34mconstant[m [32mWide_String[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m27[m[31m)[m [31m&[m [31m"[2J"[m[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 1 + 1 = 4[m
		[01;30mPut_Command_String[m [31m([mS[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mClear_Screen[m [31m([mStream [31m:[m [01;34min[m Stream_Type[31m)[m
	[01;34mis[m
		S [31m:[m [01;34mconstant[m [32mWide_String[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m27[m[31m)[m [31m&[m [31m"[2J"[m[31m;[m
	[01;34mbegin[m
		[01;30mPut_Command_String[m [31m([mStream[31m,[m S[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m Clear_From_Cursor_Up_To_End_Of_Line [31m-- Implements ESC[K[m
	[01;34mis[m
		S [31m:[m [01;34mconstant[m [32mWide_String[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m27[m[31m)[m [31m&[m [31m"[K"[m[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 1 = 3[m
		[01;30mPut_Command_String[m [31m([mS[31m);[m
	[01;34mend[m[31m;[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
	[01;34mis[m
		S [31m:[m [01;34mconstant[m [32mWide_String[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m27[m[31m)[m [31m&[m [31m"[K"[m[31m;[m
	[01;34mbegin[m
		[01;30mPut_Command_String[m [31m([mStream[31m,[m S[31m);[m
	[01;34mend[m[31m;[m

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

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

	Text_Color_Code [31m:[m [01;34mconstant[m [01;34marray[m [31m([mColor_Type[31m)[m [01;34mof[m Natural [31m:=[m 
	  [31m([m	   
	   Black   [31m=>[m [35m30[m[31m,[m
	   Red     [31m=>[m [35m31[m[31m,[m
	   Green   [31m=>[m [35m32[m[31m,[m
	   Yellow  [31m=>[m [35m33[m[31m,[m
	   Blue    [31m=>[m [35m34[m[31m,[m
	   Magenta [31m=>[m [35m35[m[31m,[m
	   Cyan    [31m=>[m [35m36[m[31m,[m
	   White   [31m=>[m [35m37[m[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;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 2 + 1 = 5[m
	   [01;30mStart[m [31m([mB[31m);[m
	   [01;30mAppend[m [31m([mB[31m,[m [31m"01;"[m[31m);[m
	   [01;30mAppend[m [31m([mB[31m,[m [01;30mText_Color_Code[m [31m([mColor[31m));[m
	   [01;30mAppend[m [31m([mB[31m,[m [31m'm'[m[31m);[m
	   [01;30mPut[m [31m([mB[31m);[m
	[01;34mend[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;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 2 + 1 = 5[m
	   [01;30mStart[m [31m([mB[31m);[m
	   
	   [01;30mAppend[m [31m([mB[31m,[m [01;30mText_Color_Code[m [31m([mColor[31m));[m
	   [01;30mAppend[m [31m([mB[31m,[m [31m'm'[m[31m);[m
	   [01;30mPut[m [31m([mB[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mSet_Text_Color[m [31m([m
		Stream [31m:[m [01;34min[m Stream_Type[31m;[m
		Color  [31m:[m [01;34min[m Color_Type[31m)[m
	[01;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [01;30mText_Color_Code[m [31m([mColor[31m));[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'm'[m[31m);[m
		[01;30mPut[m [31m([mStream[31m,[m B[31m);[m
	[01;34mend[m[31m;[m

	Background_Color_Code [31m:[m [01;34mconstant[m [01;34marray[m [31m([mColor_Type[31m)[m [01;34mof[m Natural [31m:=[m [31m([m
		Black   [31m=>[m [35m40[m[31m,[m
		Red     [31m=>[m [35m41[m[31m,[m
		Green   [31m=>[m [35m42[m[31m,[m
		Yellow  [31m=>[m [35m43[m[31m,[m
		Blue    [31m=>[m [35m44[m[31m,[m
		Magenta [31m=>[m [35m45[m[31m,[m
		Cyan    [31m=>[m [35m46[m[31m,[m
		White   [31m=>[m [35m47[m[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;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 2 + 1 = 5[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [01;30mBackground_Color_Code[m [31m([mColor[31m));[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'm'[m[31m);[m
		[01;30mPut[m [31m([mB[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mSet_Background_Color[m [31m([m
		Stream [31m:[m [01;34min[m Stream_Type[31m;[m
		Color  [31m:[m [01;34min[m Color_Type[31m)[m
	[01;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [01;30mBackground_Color_Code[m [31m([mColor[31m));[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'm'[m[31m);[m
		[01;30mPut[m [31m([mStream[31m,[m B[31m);[m
	[01;34mend[m[31m;[m

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

	Text_Attributes_Code [31m:[m [01;34mconstant[m [01;34marray[m [31m([mText_Attributes_Type[31m)[m [01;34mof[m Natural [31m:=[m [31m([m
		Default_Text_Attributes [31m=>[m  [35m0[m[31m,[m
		Bold_Text               [31m=>[m  [35m1[m[31m,[m
		Thin_Text               [31m=>[m  [35m2[m[31m,[m
		Standout_Text           [31m=>[m  [35m3[m[31m,[m
		Underlined_Text         [31m=>[m  [35m4[m[31m,[m
		Blinking_Text           [31m=>[m  [35m5[m[31m,[m
		Reversed_Colors         [31m=>[m  [35m7[m[31m,[m
		Hidden_Text             [31m=>[m  [35m8[m[31m,[m
		Normal_Text             [31m=>[m [35m22[m[31m,[m
		Not_Standout_Text       [31m=>[m [35m23[m[31m,[m
		Not_Underlined_Text     [31m=>[m [35m24[m[31m,[m
		Not_Blinking_Text       [31m=>[m [35m25[m[31m,[m
		Not_Reversed_Text       [31m=>[m [35m27[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;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 2 + 1 = 5[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [01;30mText_Attributes_Code[m [31m([mText_Attributes[31m));[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'm'[m[31m);[m
		[01;30mPut[m [31m([mB[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mSet_Text_Attributes[m [31m([m
		Stream          [31m:[m [01;34min[m Stream_Type[31m;[m
		Text_Attributes [31m:[m [01;34min[m Text_Attributes_Type[31m)[m
	[01;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [01;30mText_Attributes_Code[m [31m([mText_Attributes[31m));[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'm'[m[31m);[m
		[01;30mPut[m [31m([mStream[31m,[m B[31m);[m
	[01;34mend[m[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;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 4 + 1 + 4 + 1 = 12[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m Line[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m';'[m[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m Column[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'H'[m[31m);[m
		[01;30mPut[m [31m([mB[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mMove_Cursor_To[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
	[01;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m Line[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m';'[m[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m Column[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'H'[m[31m);[m
		[01;30mPut[m [31m([mStream[31m,[m B[31m);[m
	[01;34mend[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;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 4 + 1 = 7[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m Count[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'A'[m[31m);[m
		[01;30mPut[m [31m([mB[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mMove_Cursor_Up[m [31m([m
		Stream [31m:[m [01;34min[m Stream_Type[31m;[m
		Count  [31m:[m [01;34min[m Vertical_Delta_Type[31m)[m
	[01;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m Count[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'A'[m[31m);[m
		[01;30mPut[m [31m([mStream[31m,[m B[31m);[m
	[01;34mend[m[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;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 4 + 1 = 7[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m Count[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'B'[m[31m);[m
		[01;30mPut[m [31m([mB[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mMove_Cursor_Down[m [31m([m
		Stream [31m:[m [01;34min[m Stream_Type[31m;[m
		Count  [31m:[m [01;34min[m Vertical_Delta_Type[31m)[m
	[01;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m Count[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'B'[m[31m);[m
		[01;30mPut[m [31m([mStream[31m,[m B[31m);[m
	[01;34mend[m[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;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 4 + 1 = 7[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m Count[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'C'[m[31m);[m
		[01;30mPut[m [31m([mB[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mMove_Cursor_Right[m [31m([m
		Stream [31m:[m [01;34min[m Stream_Type[31m;[m
		Count  [31m:[m [01;34min[m Horizontal_Delta_Type[31m)[m
	[01;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m Count[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'C'[m[31m);[m
		[01;30mPut[m [31m([mStream[31m,[m B[31m);[m
	[01;34mend[m[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;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 4 + 1 = 7[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m Count[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'D'[m[31m);[m
		[01;30mPut[m [31m([mB[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mMove_Cursor_Left[m [31m([m
		Stream [31m:[m [01;34min[m Stream_Type[31m;[m
		Count  [31m:[m [01;34min[m Horizontal_Delta_Type[31m)[m
	[01;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m Count[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'D'[m[31m);[m
		[01;30mPut[m [31m([mStream[31m,[m B[31m);[m
	[01;34mend[m[31m;[m

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

	[01;34mprocedure[m Save_Cursor_Position [31m-- Implements ESC[s[m
	[01;34mis[m
		S [31m:[m [01;34mconstant[m [32mWide_String[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m27[m[31m)[m [31m&[m [31m"[s"[m[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 1 = 3[m
		[01;30mPut_Command_String[m [31m([mS[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mSave_Cursor_Position[m [31m([mStream [31m:[m [01;34min[m Stream_Type[31m)[m
	[01;34mis[m
		S [31m:[m [01;34mconstant[m [32mWide_String[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m27[m[31m)[m [31m&[m [31m"[s"[m[31m;[m
	[01;34mbegin[m
		[01;30mPut_Command_String[m [31m([mStream[31m,[m S[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m Restore_Cursor_Position [31m-- Implements ESC[u[m
	[01;34mis[m
		S [31m:[m [01;34mconstant[m [32mWide_String[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m27[m[31m)[m [31m&[m [31m"[u"[m[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 1 = 3[m
		[01;30mPut_Command_String[m [31m([mS[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mRestore_Cursor_Position[m [31m([mStream [31m:[m [01;34min[m Stream_Type[31m)[m
	[01;34mis[m
		S [31m:[m [01;34mconstant[m [32mWide_String[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m27[m[31m)[m [31m&[m [31m"[u"[m[31m;[m
	[01;34mbegin[m
		[01;30mPut_Command_String[m [31m([mStream[31m,[m S[31m);[m
	[01;34mend[m[31m;[m

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

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

	Screen_Mode_Code [31m:[m [01;34mconstant[m [01;34marray[m [31m([mScreen_Mode_Type[31m)[m [01;34mof[m Natural [31m:=[m [31m([m
		Monochrome_Text_Mode_40x25      [31m=>[m  [35m0[m[31m,[m
		Color_Text_Mode_40x25           [31m=>[m  [35m1[m[31m,[m
		Monochrome_Text_Mode_80x25      [31m=>[m  [35m2[m[31m,[m
		Color_Text_Mode_80x25           [31m=>[m  [35m3[m[31m,[m
		Color4_Graphic_Mode_320x200     [31m=>[m  [35m4[m[31m,[m
		Monochrome_Graphic_Mode_320x200 [31m=>[m  [35m5[m[31m,[m
		Monochrome_Graphic_Mode_640x200 [31m=>[m  [35m6[m[31m,[m
		Color_Graphic_Mode_320x200      [31m=>[m [35m13[m[31m,[m
		Color16_Graphic_Mode_640x200    [31m=>[m [35m14[m[31m,[m
		Monochrome_Graphic_Mode_640x350 [31m=>[m [35m15[m[31m,[m
		Color16_Graphic_Mode_640x350    [31m=>[m [35m16[m[31m,[m
		Monochrome_Graphic_Mode_640x480 [31m=>[m [35m17[m[31m,[m
		Color16_Graphic_Mode_640x480    [31m=>[m [35m18[m[31m,[m
		Color256_Graphic_Mode_320x200   [31m=>[m [35m19[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;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 1 + 2 + 1 = 6[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'='[m[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [01;30mScreen_Mode_Code[m [31m([mScreen_Mode[31m));[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'h'[m[31m);[m
		[01;30mPut[m [31m([mB[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mSet_Screen_Mode[m [31m([m
		Stream      [31m:[m [01;34min[m Stream_Type[31m;[m
		Screen_Mode [31m:[m [01;34min[m Screen_Mode_Type[31m)[m
	[01;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'='[m[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [01;30mScreen_Mode_Code[m [31m([mScreen_Mode[31m));[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'h'[m[31m);[m
		[01;30mPut[m [31m([mStream[31m,[m B[31m);[m
	[01;34mend[m[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;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 1 + 2 + 1 = 6[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'='[m[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [01;30mScreen_Mode_Code[m [31m([mScreen_Mode[31m));[m
		[01;30mAppend[m [31m([mB[31m,[m [31m's'[m[31m);[m
		[01;30mPut[m [31m([mB[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mReset_Screen_Mode[m [31m([m
		Stream      [31m:[m [01;34min[m Stream_Type[31m;[m
		Screen_Mode [31m:[m [01;34min[m Screen_Mode_Type[31m)[m
	[01;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [31m'='[m[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [01;30mScreen_Mode_Code[m [31m([mScreen_Mode[31m));[m
		[01;30mAppend[m [31m([mB[31m,[m [31m's'[m[31m);[m
		[01;30mPut[m [31m([mStream[31m,[m B[31m);[m
	[01;34mend[m[31m;[m

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

	[01;34mprocedure[m Enable_Line_Wrapping [31m-- Implements part of ESC[=Psh[m
	[01;34mis[m
		S [31m:[m [01;34mconstant[m [32mWide_String[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m27[m[31m)[m [31m&[m [31m"[=7h"[m[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 1 + 1 + 1 = 5[m
		[01;30mPut_Command_String[m [31m([mS[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mEnable_Line_Wrapping[m [31m([mStream [31m:[m [01;34min[m Stream_Type[31m)[m
	[01;34mis[m
		S [31m:[m [01;34mconstant[m [32mWide_String[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m27[m[31m)[m [31m&[m [31m"[=7h"[m[31m;[m
	[01;34mbegin[m
		[01;30mPut_Command_String[m [31m([mStream[31m,[m S[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m Disable_Line_Wrapping [31m-- Implements part of ESC[=Psl[m
	[01;34mis[m
		S [31m:[m [01;34mconstant[m [32mWide_String[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m27[m[31m)[m [31m&[m [31m"[=7l"[m[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + 1 + 1 + 1 = 5[m
		[01;30mPut_Command_String[m [31m([mS[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mDisable_Line_Wrapping[m [31m([mStream [31m:[m [01;34min[m Stream_Type[31m)[m
	[01;34mis[m
		S [31m:[m [01;34mconstant[m [32mWide_String[m [31m:=[m Wide_Character'[01;30mVal[m [31m([m[35m27[m[31m)[m [31m&[m [31m"[=7l"[m[31m;[m
	[01;34mbegin[m
		[01;30mPut_Command_String[m [31m([mStream[31m,[m S[31m);[m
	[01;34mend[m[31m;[m

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

	[31m-- Function for keystroke string code[m
	[31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[m

	[31m-- As string lengths vary, an associative array cannot be used,[m
	[31m-- so it is implemented as a function built on a case statement.[m
	[31m-- The second good raison for using a function in place of an[m
	[31m-- associative array, is that an array cannot raise an exception :P[m
	[31m-- ... and we may need to raise Illegal_Keystroke in case of an[m
	[31m-- illegal modifier+key combination.[m

	[01;34mfunction[m [01;30mKey_String_Code_Whith_No_Modifier_Key[m [31m([mKey [31m:[m [01;34min[m Key_Type[31m)[m
	[01;34mreturn[m [32mWide_String[m
	[01;34mis[m
	[01;34mbegin[m
		[01;34mcase[m Key [01;34mis[m
		[01;34mwhen[m Key_F1                [31m=>[m [01;34mreturn[m [31m"0;59"[m[31m;[m
		[01;34mwhen[m Key_F2                [31m=>[m [01;34mreturn[m [31m"0;60"[m[31m;[m
		[01;34mwhen[m Key_F3                [31m=>[m [01;34mreturn[m [31m"0;61"[m[31m;[m
		[01;34mwhen[m Key_F4                [31m=>[m [01;34mreturn[m [31m"0;62"[m[31m;[m
		[01;34mwhen[m Key_F5                [31m=>[m [01;34mreturn[m [31m"0;63"[m[31m;[m
		[01;34mwhen[m Key_F6                [31m=>[m [01;34mreturn[m [31m"0;64"[m[31m;[m
		[01;34mwhen[m Key_F7                [31m=>[m [01;34mreturn[m [31m"0;65"[m[31m;[m
		[01;34mwhen[m Key_F8                [31m=>[m [01;34mreturn[m [31m"0;66"[m[31m;[m
		[01;34mwhen[m Key_F9                [31m=>[m [01;34mreturn[m [31m"0;67"[m[31m;[m
		[01;34mwhen[m Key_F10               [31m=>[m [01;34mreturn[m [31m"0;68"[m[31m;[m
		[01;34mwhen[m Key_F11               [31m=>[m [01;34mreturn[m [31m"0;133"[m[31m;[m
		[01;34mwhen[m Key_F12               [31m=>[m [01;34mreturn[m [31m"0;134"[m[31m;[m
		[01;34mwhen[m Keypad_Home           [31m=>[m [01;34mreturn[m [31m"0;71"[m[31m;[m
		[01;34mwhen[m Keypad_Up_Arrow       [31m=>[m [01;34mreturn[m [31m"0;72"[m[31m;[m
		[01;34mwhen[m Keypad_Page_Up        [31m=>[m [01;34mreturn[m [31m"0;73"[m[31m;[m
		[01;34mwhen[m Keypad_Left_Arrow     [31m=>[m [01;34mreturn[m [31m"0;75"[m[31m;[m
		[01;34mwhen[m Keypad_Right_Arrow    [31m=>[m [01;34mreturn[m [31m"0;77"[m[31m;[m
		[01;34mwhen[m Keypad_End            [31m=>[m [01;34mreturn[m [31m"0;79"[m[31m;[m
		[01;34mwhen[m Keypad_Down_Arrow     [31m=>[m [01;34mreturn[m [31m"0;80"[m[31m;[m
		[01;34mwhen[m Keypad_Page_Down      [31m=>[m [01;34mreturn[m [31m"0;81"[m[31m;[m
		[01;34mwhen[m Keypad_Insert         [31m=>[m [01;34mreturn[m [31m"0;82"[m[31m;[m
		[01;34mwhen[m Keypad_Delete         [31m=>[m [01;34mreturn[m [31m"0;83"[m[31m;[m
		[01;34mwhen[m Key_Home              [31m=>[m [01;34mreturn[m [31m"(224;71)"[m[31m;[m
		[01;34mwhen[m Key_Up_Arrow          [31m=>[m [01;34mreturn[m [31m"(224;72)"[m[31m;[m
		[01;34mwhen[m Key_Page_Up           [31m=>[m [01;34mreturn[m [31m"(224;73)"[m[31m;[m
		[01;34mwhen[m Key_Left_Arrow        [31m=>[m [01;34mreturn[m [31m"(224;75)"[m[31m;[m
		[01;34mwhen[m Key_Right_Arrow       [31m=>[m [01;34mreturn[m [31m"(224;77)"[m[31m;[m
		[01;34mwhen[m Key_End               [31m=>[m [01;34mreturn[m [31m"(224;79)"[m[31m;[m
		[01;34mwhen[m Key_Down_Arrow        [31m=>[m [01;34mreturn[m [31m"(224;80)"[m[31m;[m
		[01;34mwhen[m Key_Page_Down         [31m=>[m [01;34mreturn[m [31m"(224;81)"[m[31m;[m
		[01;34mwhen[m Key_Insert            [31m=>[m [01;34mreturn[m [31m"(224;82)"[m[31m;[m
		[01;34mwhen[m Key_Delete            [31m=>[m [01;34mreturn[m [31m"(224;83)"[m[31m;[m
		[01;34mwhen[m Key_Print_Screen      [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Pause_Break       [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Escape            [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Backspace         [31m=>[m [01;34mreturn[m [31m"8"[m[31m;[m
		[01;34mwhen[m Key_Enter             [31m=>[m [01;34mreturn[m [31m"13"[m[31m;[m
		[01;34mwhen[m Key_Tab               [31m=>[m [01;34mreturn[m [31m"9"[m[31m;[m
		[01;34mwhen[m Key_Null              [31m=>[m [01;34mreturn[m [31m"0;3"[m[31m;[m
		[01;34mwhen[m Key_A                 [31m=>[m [01;34mreturn[m [31m"97"[m[31m;[m
		[01;34mwhen[m Key_B                 [31m=>[m [01;34mreturn[m [31m"98"[m[31m;[m
		[01;34mwhen[m Key_C                 [31m=>[m [01;34mreturn[m [31m"99"[m[31m;[m
		[01;34mwhen[m Key_D                 [31m=>[m [01;34mreturn[m [31m"100"[m[31m;[m
		[01;34mwhen[m Key_E                 [31m=>[m [01;34mreturn[m [31m"101"[m[31m;[m
		[01;34mwhen[m Key_F                 [31m=>[m [01;34mreturn[m [31m"102"[m[31m;[m
		[01;34mwhen[m Key_G                 [31m=>[m [01;34mreturn[m [31m"103"[m[31m;[m
		[01;34mwhen[m Key_H                 [31m=>[m [01;34mreturn[m [31m"104"[m[31m;[m
		[01;34mwhen[m Key_I                 [31m=>[m [01;34mreturn[m [31m"105"[m[31m;[m
		[01;34mwhen[m Key_J                 [31m=>[m [01;34mreturn[m [31m"106"[m[31m;[m
		[01;34mwhen[m Key_K                 [31m=>[m [01;34mreturn[m [31m"107"[m[31m;[m
		[01;34mwhen[m Key_L                 [31m=>[m [01;34mreturn[m [31m"108"[m[31m;[m
		[01;34mwhen[m Key_M                 [31m=>[m [01;34mreturn[m [31m"109"[m[31m;[m
		[01;34mwhen[m Key_N                 [31m=>[m [01;34mreturn[m [31m"110"[m[31m;[m
		[01;34mwhen[m Key_O                 [31m=>[m [01;34mreturn[m [31m"111"[m[31m;[m
		[01;34mwhen[m Key_P                 [31m=>[m [01;34mreturn[m [31m"112"[m[31m;[m
		[01;34mwhen[m Key_Q                 [31m=>[m [01;34mreturn[m [31m"113"[m[31m;[m
		[01;34mwhen[m Key_R                 [31m=>[m [01;34mreturn[m [31m"114"[m[31m;[m
		[01;34mwhen[m Key_S                 [31m=>[m [01;34mreturn[m [31m"115"[m[31m;[m
		[01;34mwhen[m Key_T                 [31m=>[m [01;34mreturn[m [31m"116"[m[31m;[m
		[01;34mwhen[m Key_U                 [31m=>[m [01;34mreturn[m [31m"117"[m[31m;[m
		[01;34mwhen[m Key_V                 [31m=>[m [01;34mreturn[m [31m"118"[m[31m;[m
		[01;34mwhen[m Key_W                 [31m=>[m [01;34mreturn[m [31m"119"[m[31m;[m
		[01;34mwhen[m Key_X                 [31m=>[m [01;34mreturn[m [31m"120"[m[31m;[m
		[01;34mwhen[m Key_Y                 [31m=>[m [01;34mreturn[m [31m"121"[m[31m;[m
		[01;34mwhen[m Key_Z                 [31m=>[m [01;34mreturn[m [31m"122"[m[31m;[m
		[01;34mwhen[m Key_1                 [31m=>[m [01;34mreturn[m [31m"49"[m[31m;[m
		[01;34mwhen[m Key_2                 [31m=>[m [01;34mreturn[m [31m"50"[m[31m;[m
		[01;34mwhen[m Key_3                 [31m=>[m [01;34mreturn[m [31m"51"[m[31m;[m
		[01;34mwhen[m Key_4                 [31m=>[m [01;34mreturn[m [31m"52"[m[31m;[m
		[01;34mwhen[m Key_5                 [31m=>[m [01;34mreturn[m [31m"53"[m[31m;[m
		[01;34mwhen[m Key_6                 [31m=>[m [01;34mreturn[m [31m"54"[m[31m;[m
		[01;34mwhen[m Key_7                 [31m=>[m [01;34mreturn[m [31m"55"[m[31m;[m
		[01;34mwhen[m Key_8                 [31m=>[m [01;34mreturn[m [31m"56"[m[31m;[m
		[01;34mwhen[m Key_9                 [31m=>[m [01;34mreturn[m [31m"57"[m[31m;[m
		[01;34mwhen[m Key_0                 [31m=>[m [01;34mreturn[m [31m"48"[m[31m;[m
		[01;34mwhen[m Key_Minus             [31m=>[m [01;34mreturn[m [31m"45"[m[31m;[m
		[01;34mwhen[m Key_Equal             [31m=>[m [01;34mreturn[m [31m"61"[m[31m;[m
		[01;34mwhen[m Key_Left_Square       [31m=>[m [01;34mreturn[m [31m"91"[m[31m;[m
		[01;34mwhen[m Key_Right_Square      [31m=>[m [01;34mreturn[m [31m"93"[m[31m;[m
		[01;34mwhen[m Key_Space             [31m=>[m [01;34mreturn[m [31m"92"[m[31m;[m
		[01;34mwhen[m Key_Semicolon         [31m=>[m [01;34mreturn[m [31m"59"[m[31m;[m
		[01;34mwhen[m Key_Single_Quote      [31m=>[m [01;34mreturn[m [31m"39"[m[31m;[m
		[01;34mwhen[m Key_Comma             [31m=>[m [01;34mreturn[m [31m"44"[m[31m;[m
		[01;34mwhen[m Key_Dot               [31m=>[m [01;34mreturn[m [31m"46"[m[31m;[m
		[01;34mwhen[m Key_Slash             [31m=>[m [01;34mreturn[m [31m"47"[m[31m;[m
		[01;34mwhen[m Key_Left_Single_Quote [31m=>[m [01;34mreturn[m [31m"96"[m[31m;[m
		[01;34mwhen[m Keypad_Enter          [31m=>[m [01;34mreturn[m [31m"13"[m[31m;[m
		[01;34mwhen[m Keypad_Slash          [31m=>[m [01;34mreturn[m [31m"47"[m[31m;[m
		[01;34mwhen[m Keypad_Star           [31m=>[m [01;34mreturn[m [31m"42"[m[31m;[m
		[01;34mwhen[m Keypad_Minus          [31m=>[m [01;34mreturn[m [31m"45"[m[31m;[m
		[01;34mwhen[m Keypad_Plus           [31m=>[m [01;34mreturn[m [31m"43"[m[31m;[m
		[01;34mwhen[m Keypad_Middle         [31m=>[m [01;34mreturn[m [31m"(0;76)"[m[31m;[m
		[01;34mend[m [01;34mcase[m[31m;[m
	[01;34mend[m[31m;[m

	[01;34mfunction[m [01;30mKey_String_Code_Whith_Shift_Key[m [31m([mKey [31m:[m [01;34min[m Key_Type[31m)[m
	[01;34mreturn[m [32mWide_String[m
	[01;34mis[m
	[01;34mbegin[m
		[01;34mcase[m Key [01;34mis[m
		[01;34mwhen[m Key_F1                [31m=>[m [01;34mreturn[m [31m"0;84"[m[31m;[m
		[01;34mwhen[m Key_F2                [31m=>[m [01;34mreturn[m [31m"0;85"[m[31m;[m
		[01;34mwhen[m Key_F3                [31m=>[m [01;34mreturn[m [31m"0;86"[m[31m;[m
		[01;34mwhen[m Key_F4                [31m=>[m [01;34mreturn[m [31m"0;87"[m[31m;[m
		[01;34mwhen[m Key_F5                [31m=>[m [01;34mreturn[m [31m"0;88"[m[31m;[m
		[01;34mwhen[m Key_F6                [31m=>[m [01;34mreturn[m [31m"0;89"[m[31m;[m
		[01;34mwhen[m Key_F7                [31m=>[m [01;34mreturn[m [31m"0;90"[m[31m;[m
		[01;34mwhen[m Key_F8                [31m=>[m [01;34mreturn[m [31m"0;91"[m[31m;[m
		[01;34mwhen[m Key_F9                [31m=>[m [01;34mreturn[m [31m"0;92"[m[31m;[m
		[01;34mwhen[m Key_F10               [31m=>[m [01;34mreturn[m [31m"0;93"[m[31m;[m
		[01;34mwhen[m Key_F11               [31m=>[m [01;34mreturn[m [31m"0;135"[m[31m;[m
		[01;34mwhen[m Key_F12               [31m=>[m [01;34mreturn[m [31m"0;136"[m[31m;[m
		[01;34mwhen[m Keypad_Home           [31m=>[m [01;34mreturn[m [31m"55"[m[31m;[m
		[01;34mwhen[m Keypad_Up_Arrow       [31m=>[m [01;34mreturn[m [31m"56"[m[31m;[m
		[01;34mwhen[m Keypad_Page_Up        [31m=>[m [01;34mreturn[m [31m"57"[m[31m;[m
		[01;34mwhen[m Keypad_Left_Arrow     [31m=>[m [01;34mreturn[m [31m"52"[m[31m;[m
		[01;34mwhen[m Keypad_Right_Arrow    [31m=>[m [01;34mreturn[m [31m"54"[m[31m;[m
		[01;34mwhen[m Keypad_End            [31m=>[m [01;34mreturn[m [31m"49"[m[31m;[m
		[01;34mwhen[m Keypad_Down_Arrow     [31m=>[m [01;34mreturn[m [31m"50"[m[31m;[m
		[01;34mwhen[m Keypad_Page_Down      [31m=>[m [01;34mreturn[m [31m"51"[m[31m;[m
		[01;34mwhen[m Keypad_Insert         [31m=>[m [01;34mreturn[m [31m"48"[m[31m;[m
		[01;34mwhen[m Keypad_Delete         [31m=>[m [01;34mreturn[m [31m"46"[m[31m;[m
		[01;34mwhen[m Key_Home              [31m=>[m [01;34mreturn[m [31m"(224;71)"[m[31m;[m
		[01;34mwhen[m Key_Up_Arrow          [31m=>[m [01;34mreturn[m [31m"(224;72)"[m[31m;[m
		[01;34mwhen[m Key_Page_Up           [31m=>[m [01;34mreturn[m [31m"(224;73)"[m[31m;[m
		[01;34mwhen[m Key_Left_Arrow        [31m=>[m [01;34mreturn[m [31m"(224;75)"[m[31m;[m
		[01;34mwhen[m Key_Right_Arrow       [31m=>[m [01;34mreturn[m [31m"(224;77)"[m[31m;[m
		[01;34mwhen[m Key_End               [31m=>[m [01;34mreturn[m [31m"(224;79)"[m[31m;[m
		[01;34mwhen[m Key_Down_Arrow        [31m=>[m [01;34mreturn[m [31m"(224;80)"[m[31m;[m
		[01;34mwhen[m Key_Page_Down         [31m=>[m [01;34mreturn[m [31m"(224;81)"[m[31m;[m
		[01;34mwhen[m Key_Insert            [31m=>[m [01;34mreturn[m [31m"(224;82)"[m[31m;[m
		[01;34mwhen[m Key_Delete            [31m=>[m [01;34mreturn[m [31m"(224;83)"[m[31m;[m
		[01;34mwhen[m Key_Print_Screen      [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Pause_Break       [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Escape            [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Backspace         [31m=>[m [01;34mreturn[m [31m"8"[m[31m;[m
		[01;34mwhen[m Key_Enter             [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Tab               [31m=>[m [01;34mreturn[m [31m"0;15"[m[31m;[m
		[01;34mwhen[m Key_Null              [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_A                 [31m=>[m [01;34mreturn[m [31m"65"[m[31m;[m
		[01;34mwhen[m Key_B                 [31m=>[m [01;34mreturn[m [31m"66"[m[31m;[m
		[01;34mwhen[m Key_C                 [31m=>[m [01;34mreturn[m [31m"66"[m[31m;[m
		[01;34mwhen[m Key_D                 [31m=>[m [01;34mreturn[m [31m"68"[m[31m;[m
		[01;34mwhen[m Key_E                 [31m=>[m [01;34mreturn[m [31m"69"[m[31m;[m
		[01;34mwhen[m Key_F                 [31m=>[m [01;34mreturn[m [31m"70"[m[31m;[m
		[01;34mwhen[m Key_G                 [31m=>[m [01;34mreturn[m [31m"71"[m[31m;[m
		[01;34mwhen[m Key_H                 [31m=>[m [01;34mreturn[m [31m"72"[m[31m;[m
		[01;34mwhen[m Key_I                 [31m=>[m [01;34mreturn[m [31m"73"[m[31m;[m
		[01;34mwhen[m Key_J                 [31m=>[m [01;34mreturn[m [31m"74"[m[31m;[m
		[01;34mwhen[m Key_K                 [31m=>[m [01;34mreturn[m [31m"75"[m[31m;[m
		[01;34mwhen[m Key_L                 [31m=>[m [01;34mreturn[m [31m"76"[m[31m;[m
		[01;34mwhen[m Key_M                 [31m=>[m [01;34mreturn[m [31m"77"[m[31m;[m
		[01;34mwhen[m Key_N                 [31m=>[m [01;34mreturn[m [31m"78"[m[31m;[m
		[01;34mwhen[m Key_O                 [31m=>[m [01;34mreturn[m [31m"79"[m[31m;[m
		[01;34mwhen[m Key_P                 [31m=>[m [01;34mreturn[m [31m"80"[m[31m;[m
		[01;34mwhen[m Key_Q                 [31m=>[m [01;34mreturn[m [31m"81"[m[31m;[m
		[01;34mwhen[m Key_R                 [31m=>[m [01;34mreturn[m [31m"82"[m[31m;[m
		[01;34mwhen[m Key_S                 [31m=>[m [01;34mreturn[m [31m"83"[m[31m;[m
		[01;34mwhen[m Key_T                 [31m=>[m [01;34mreturn[m [31m"84"[m[31m;[m
		[01;34mwhen[m Key_U                 [31m=>[m [01;34mreturn[m [31m"85"[m[31m;[m
		[01;34mwhen[m Key_V                 [31m=>[m [01;34mreturn[m [31m"86"[m[31m;[m
		[01;34mwhen[m Key_W                 [31m=>[m [01;34mreturn[m [31m"87"[m[31m;[m
		[01;34mwhen[m Key_X                 [31m=>[m [01;34mreturn[m [31m"88"[m[31m;[m
		[01;34mwhen[m Key_Y                 [31m=>[m [01;34mreturn[m [31m"89"[m[31m;[m
		[01;34mwhen[m Key_Z                 [31m=>[m [01;34mreturn[m [31m"90"[m[31m;[m
		[01;34mwhen[m Key_1                 [31m=>[m [01;34mreturn[m [31m"33"[m[31m;[m
		[01;34mwhen[m Key_2                 [31m=>[m [01;34mreturn[m [31m"64"[m[31m;[m
		[01;34mwhen[m Key_3                 [31m=>[m [01;34mreturn[m [31m"35"[m[31m;[m
		[01;34mwhen[m Key_4                 [31m=>[m [01;34mreturn[m [31m"36"[m[31m;[m
		[01;34mwhen[m Key_5                 [31m=>[m [01;34mreturn[m [31m"37"[m[31m;[m
		[01;34mwhen[m Key_6                 [31m=>[m [01;34mreturn[m [31m"94"[m[31m;[m
		[01;34mwhen[m Key_7                 [31m=>[m [01;34mreturn[m [31m"38"[m[31m;[m
		[01;34mwhen[m Key_8                 [31m=>[m [01;34mreturn[m [31m"42"[m[31m;[m
		[01;34mwhen[m Key_9                 [31m=>[m [01;34mreturn[m [31m"40"[m[31m;[m
		[01;34mwhen[m Key_0                 [31m=>[m [01;34mreturn[m [31m"41"[m[31m;[m
		[01;34mwhen[m Key_Minus             [31m=>[m [01;34mreturn[m [31m"95"[m[31m;[m
		[01;34mwhen[m Key_Equal             [31m=>[m [01;34mreturn[m [31m"43"[m[31m;[m
		[01;34mwhen[m Key_Left_Square       [31m=>[m [01;34mreturn[m [31m"123"[m[31m;[m
		[01;34mwhen[m Key_Right_Square      [31m=>[m [01;34mreturn[m [31m"125"[m[31m;[m
		[01;34mwhen[m Key_Space             [31m=>[m [01;34mreturn[m [31m"124"[m[31m;[m
		[01;34mwhen[m Key_Semicolon         [31m=>[m [01;34mreturn[m [31m"58"[m[31m;[m
		[01;34mwhen[m Key_Single_Quote      [31m=>[m [01;34mreturn[m [31m"34"[m[31m;[m
		[01;34mwhen[m Key_Comma             [31m=>[m [01;34mreturn[m [31m"60"[m[31m;[m
		[01;34mwhen[m Key_Dot               [31m=>[m [01;34mreturn[m [31m"62"[m[31m;[m
		[01;34mwhen[m Key_Slash             [31m=>[m [01;34mreturn[m [31m"63"[m[31m;[m
		[01;34mwhen[m Key_Left_Single_Quote [31m=>[m [01;34mreturn[m [31m"126"[m[31m;[m
		[01;34mwhen[m Keypad_Enter          [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Keypad_Slash          [31m=>[m [01;34mreturn[m [31m"47"[m[31m;[m
		[01;34mwhen[m Keypad_Star           [31m=>[m [01;34mreturn[m [31m"(0;144)"[m[31m;[m
		[01;34mwhen[m Keypad_Minus          [31m=>[m [01;34mreturn[m [31m"45"[m[31m;[m
		[01;34mwhen[m Keypad_Plus           [31m=>[m [01;34mreturn[m [31m"43"[m[31m;[m
		[01;34mwhen[m Keypad_Middle         [31m=>[m [01;34mreturn[m [31m"53"[m[31m;[m
		[01;34mend[m [01;34mcase[m[31m;[m
	[01;34mend[m[31m;[m

	[01;34mfunction[m [01;30mKey_String_Code_Whith_Ctrl_Key[m [31m([mKey [31m:[m [01;34min[m Key_Type[31m)[m
	[01;34mreturn[m [32mWide_String[m
	[01;34mis[m
	[01;34mbegin[m
		[01;34mcase[m Key [01;34mis[m
		[01;34mwhen[m Key_F1                [31m=>[m [01;34mreturn[m [31m"0;94"[m[31m;[m
		[01;34mwhen[m Key_F2                [31m=>[m [01;34mreturn[m [31m"0;95"[m[31m;[m
		[01;34mwhen[m Key_F3                [31m=>[m [01;34mreturn[m [31m"0;96"[m[31m;[m
		[01;34mwhen[m Key_F4                [31m=>[m [01;34mreturn[m [31m"0;97"[m[31m;[m
		[01;34mwhen[m Key_F5                [31m=>[m [01;34mreturn[m [31m"0;98"[m[31m;[m
		[01;34mwhen[m Key_F6                [31m=>[m [01;34mreturn[m [31m"0;99"[m[31m;[m
		[01;34mwhen[m Key_F7                [31m=>[m [01;34mreturn[m [31m"0;100"[m[31m;[m
		[01;34mwhen[m Key_F8                [31m=>[m [01;34mreturn[m [31m"0;101"[m[31m;[m
		[01;34mwhen[m Key_F9                [31m=>[m [01;34mreturn[m [31m"0;102"[m[31m;[m
		[01;34mwhen[m Key_F10               [31m=>[m [01;34mreturn[m [31m"0;103"[m[31m;[m
		[01;34mwhen[m Key_F11               [31m=>[m [01;34mreturn[m [31m"0;137"[m[31m;[m
		[01;34mwhen[m Key_F12               [31m=>[m [01;34mreturn[m [31m"0;138"[m[31m;[m
		[01;34mwhen[m Keypad_Home           [31m=>[m [01;34mreturn[m [31m"0;119"[m[31m;[m
		[01;34mwhen[m Keypad_Up_Arrow       [31m=>[m [01;34mreturn[m [31m"(0;141)"[m[31m;[m
		[01;34mwhen[m Keypad_Page_Up        [31m=>[m [01;34mreturn[m [31m"0;132"[m[31m;[m
		[01;34mwhen[m Keypad_Left_Arrow     [31m=>[m [01;34mreturn[m [31m"0;115"[m[31m;[m
		[01;34mwhen[m Keypad_Right_Arrow    [31m=>[m [01;34mreturn[m [31m"0;116"[m[31m;[m
		[01;34mwhen[m Keypad_End            [31m=>[m [01;34mreturn[m [31m"0;117"[m[31m;[m
		[01;34mwhen[m Keypad_Down_Arrow     [31m=>[m [01;34mreturn[m [31m"(0;145)"[m[31m;[m
		[01;34mwhen[m Keypad_Page_Down      [31m=>[m [01;34mreturn[m [31m"0;118"[m[31m;[m
		[01;34mwhen[m Keypad_Insert         [31m=>[m [01;34mreturn[m [31m"(0;146)"[m[31m;[m
		[01;34mwhen[m Keypad_Delete         [31m=>[m [01;34mreturn[m [31m"(0;147)"[m[31m;[m
		[01;34mwhen[m Key_Home              [31m=>[m [01;34mreturn[m [31m"(224;119)"[m[31m;[m
		[01;34mwhen[m Key_Up_Arrow          [31m=>[m [01;34mreturn[m [31m"(224;141)"[m[31m;[m
		[01;34mwhen[m Key_Page_Up           [31m=>[m [01;34mreturn[m [31m"(224;132)"[m[31m;[m
		[01;34mwhen[m Key_Left_Arrow        [31m=>[m [01;34mreturn[m [31m"(224;115)"[m[31m;[m
		[01;34mwhen[m Key_Right_Arrow       [31m=>[m [01;34mreturn[m [31m"(224;116)"[m[31m;[m
		[01;34mwhen[m Key_End               [31m=>[m [01;34mreturn[m [31m"(224;117)"[m[31m;[m
		[01;34mwhen[m Key_Down_Arrow        [31m=>[m [01;34mreturn[m [31m"(224;145)"[m[31m;[m
		[01;34mwhen[m Key_Page_Down         [31m=>[m [01;34mreturn[m [31m"(224;118)"[m[31m;[m
		[01;34mwhen[m Key_Insert            [31m=>[m [01;34mreturn[m [31m"(224;146)"[m[31m;[m
		[01;34mwhen[m Key_Delete            [31m=>[m [01;34mreturn[m [31m"(224;147)"[m[31m;[m
		[01;34mwhen[m Key_Print_Screen      [31m=>[m [01;34mreturn[m [31m"0;114"[m[31m;[m
		[01;34mwhen[m Key_Pause_Break       [31m=>[m [01;34mreturn[m [31m"0;0"[m[31m;[m
		[01;34mwhen[m Key_Escape            [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Backspace         [31m=>[m [01;34mreturn[m [31m"127"[m[31m;[m
		[01;34mwhen[m Key_Enter             [31m=>[m [01;34mreturn[m [31m"10"[m[31m;[m
		[01;34mwhen[m Key_Tab               [31m=>[m [01;34mreturn[m [31m"(0;148)"[m[31m;[m
		[01;34mwhen[m Key_Null              [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_A                 [31m=>[m [01;34mreturn[m [31m"1"[m[31m;[m
		[01;34mwhen[m Key_B                 [31m=>[m [01;34mreturn[m [31m"2"[m[31m;[m
		[01;34mwhen[m Key_C                 [31m=>[m [01;34mreturn[m [31m"3"[m[31m;[m
		[01;34mwhen[m Key_D                 [31m=>[m [01;34mreturn[m [31m"4"[m[31m;[m
		[01;34mwhen[m Key_E                 [31m=>[m [01;34mreturn[m [31m"5"[m[31m;[m
		[01;34mwhen[m Key_F                 [31m=>[m [01;34mreturn[m [31m"6"[m[31m;[m
		[01;34mwhen[m Key_G                 [31m=>[m [01;34mreturn[m [31m"7"[m[31m;[m
		[01;34mwhen[m Key_H                 [31m=>[m [01;34mreturn[m [31m"8"[m[31m;[m
		[01;34mwhen[m Key_I                 [31m=>[m [01;34mreturn[m [31m"9"[m[31m;[m
		[01;34mwhen[m Key_J                 [31m=>[m [01;34mreturn[m [31m"10"[m[31m;[m
		[01;34mwhen[m Key_K                 [31m=>[m [01;34mreturn[m [31m"11"[m[31m;[m
		[01;34mwhen[m Key_L                 [31m=>[m [01;34mreturn[m [31m"12"[m[31m;[m
		[01;34mwhen[m Key_M                 [31m=>[m [01;34mreturn[m [31m"13"[m[31m;[m
		[01;34mwhen[m Key_N                 [31m=>[m [01;34mreturn[m [31m"14"[m[31m;[m
		[01;34mwhen[m Key_O                 [31m=>[m [01;34mreturn[m [31m"15"[m[31m;[m
		[01;34mwhen[m Key_P                 [31m=>[m [01;34mreturn[m [31m"16"[m[31m;[m
		[01;34mwhen[m Key_Q                 [31m=>[m [01;34mreturn[m [31m"17"[m[31m;[m
		[01;34mwhen[m Key_R                 [31m=>[m [01;34mreturn[m [31m"18"[m[31m;[m
		[01;34mwhen[m Key_S                 [31m=>[m [01;34mreturn[m [31m"19"[m[31m;[m
		[01;34mwhen[m Key_T                 [31m=>[m [01;34mreturn[m [31m"20"[m[31m;[m
		[01;34mwhen[m Key_U                 [31m=>[m [01;34mreturn[m [31m"21"[m[31m;[m
		[01;34mwhen[m Key_V                 [31m=>[m [01;34mreturn[m [31m"22"[m[31m;[m
		[01;34mwhen[m Key_W                 [31m=>[m [01;34mreturn[m [31m"23"[m[31m;[m
		[01;34mwhen[m Key_X                 [31m=>[m [01;34mreturn[m [31m"24"[m[31m;[m
		[01;34mwhen[m Key_Y                 [31m=>[m [01;34mreturn[m [31m"25"[m[31m;[m
		[01;34mwhen[m Key_Z                 [31m=>[m [01;34mreturn[m [31m"26"[m[31m;[m
		[01;34mwhen[m Key_1                 [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_2                 [31m=>[m [01;34mreturn[m [31m"0"[m[31m;[m
		[01;34mwhen[m Key_3                 [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_4                 [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_5                 [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_6                 [31m=>[m [01;34mreturn[m [31m"30"[m[31m;[m
		[01;34mwhen[m Key_7                 [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_8                 [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_9                 [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_0                 [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Minus             [31m=>[m [01;34mreturn[m [31m"31"[m[31m;[m
		[01;34mwhen[m Key_Equal             [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Left_Square       [31m=>[m [01;34mreturn[m [31m"27"[m[31m;[m
		[01;34mwhen[m Key_Right_Square      [31m=>[m [01;34mreturn[m [31m"29"[m[31m;[m
		[01;34mwhen[m Key_Space             [31m=>[m [01;34mreturn[m [31m"28"[m[31m;[m
		[01;34mwhen[m Key_Semicolon         [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Single_Quote      [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Comma             [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Dot               [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Slash             [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Left_Single_Quote [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Keypad_Enter          [31m=>[m [01;34mreturn[m [31m"10"[m[31m;[m
		[01;34mwhen[m Keypad_Slash          [31m=>[m [01;34mreturn[m [31m"(0;142)"[m[31m;[m
		[01;34mwhen[m Keypad_Star           [31m=>[m [01;34mreturn[m [31m"(0;78)"[m[31m;[m
		[01;34mwhen[m Keypad_Minus          [31m=>[m [01;34mreturn[m [31m"(0;149)"[m[31m;[m
		[01;34mwhen[m Keypad_Plus           [31m=>[m [01;34mreturn[m [31m"(0;150)"[m[31m;[m
		[01;34mwhen[m Keypad_Middle         [31m=>[m [01;34mreturn[m [31m"(0;143)"[m[31m;[m
		[01;34mend[m [01;34mcase[m[31m;[m
	[01;34mend[m[31m;[m

	[01;34mfunction[m [01;30mKey_String_Code_Whith_Alt_Key[m [31m([mKey [31m:[m [01;34min[m Key_Type[31m)[m
	[01;34mreturn[m [32mWide_String[m
	[01;34mis[m
	[01;34mbegin[m
		[01;34mcase[m Key [01;34mis[m
		[01;34mwhen[m Key_F1                [31m=>[m [01;34mreturn[m [31m"0;104"[m[31m;[m
		[01;34mwhen[m Key_F2                [31m=>[m [01;34mreturn[m [31m"0;105"[m[31m;[m
		[01;34mwhen[m Key_F3                [31m=>[m [01;34mreturn[m [31m"0;106"[m[31m;[m
		[01;34mwhen[m Key_F4                [31m=>[m [01;34mreturn[m [31m"0;107"[m[31m;[m
		[01;34mwhen[m Key_F5                [31m=>[m [01;34mreturn[m [31m"0;108"[m[31m;[m
		[01;34mwhen[m Key_F6                [31m=>[m [01;34mreturn[m [31m"0;109"[m[31m;[m
		[01;34mwhen[m Key_F7                [31m=>[m [01;34mreturn[m [31m"0;110"[m[31m;[m
		[01;34mwhen[m Key_F8                [31m=>[m [01;34mreturn[m [31m"0;111"[m[31m;[m
		[01;34mwhen[m Key_F9                [31m=>[m [01;34mreturn[m [31m"0;112"[m[31m;[m
		[01;34mwhen[m Key_F10               [31m=>[m [01;34mreturn[m [31m"0;113"[m[31m;[m
		[01;34mwhen[m Key_F11               [31m=>[m [01;34mreturn[m [31m"0;139"[m[31m;[m
		[01;34mwhen[m Key_F12               [31m=>[m [01;34mreturn[m [31m"0;140"[m[31m;[m
		[01;34mwhen[m Keypad_Home           [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Keypad_Up_Arrow       [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Keypad_Page_Up        [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Keypad_Left_Arrow     [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Keypad_Right_Arrow    [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Keypad_End            [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Keypad_Down_Arrow     [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Keypad_Page_Down      [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Keypad_Insert         [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Keypad_Delete         [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Home              [31m=>[m [01;34mreturn[m [31m"(224;151)"[m[31m;[m
		[01;34mwhen[m Key_Up_Arrow          [31m=>[m [01;34mreturn[m [31m"(224;152)"[m[31m;[m
		[01;34mwhen[m Key_Page_Up           [31m=>[m [01;34mreturn[m [31m"(224;153)"[m[31m;[m
		[01;34mwhen[m Key_Left_Arrow        [31m=>[m [01;34mreturn[m [31m"(224;155)"[m[31m;[m
		[01;34mwhen[m Key_Right_Arrow       [31m=>[m [01;34mreturn[m [31m"(224;157)"[m[31m;[m
		[01;34mwhen[m Key_End               [31m=>[m [01;34mreturn[m [31m"(224;159)"[m[31m;[m
		[01;34mwhen[m Key_Down_Arrow        [31m=>[m [01;34mreturn[m [31m"(224;154)"[m[31m;[m
		[01;34mwhen[m Key_Page_Down         [31m=>[m [01;34mreturn[m [31m"(224;161)"[m[31m;[m
		[01;34mwhen[m Key_Insert            [31m=>[m [01;34mreturn[m [31m"(224;162)"[m[31m;[m
		[01;34mwhen[m Key_Delete            [31m=>[m [01;34mreturn[m [31m"(224;163)"[m[31m;[m
		[01;34mwhen[m Key_Print_Screen      [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Pause_Break       [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Escape            [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_Backspace         [31m=>[m [01;34mreturn[m [31m"(0)"[m[31m;[m
		[01;34mwhen[m Key_Enter             [31m=>[m [01;34mreturn[m [31m"(0"[m[31m;[m
		[01;34mwhen[m Key_Tab               [31m=>[m [01;34mreturn[m [31m"(0;165)"[m[31m;[m
		[01;34mwhen[m Key_Null              [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Key_A                 [31m=>[m [01;34mreturn[m [31m"0;30"[m[31m;[m
		[01;34mwhen[m Key_B                 [31m=>[m [01;34mreturn[m [31m"0;48"[m[31m;[m
		[01;34mwhen[m Key_C                 [31m=>[m [01;34mreturn[m [31m"0;46"[m[31m;[m
		[01;34mwhen[m Key_D                 [31m=>[m [01;34mreturn[m [31m"0;32"[m[31m;[m
		[01;34mwhen[m Key_E                 [31m=>[m [01;34mreturn[m [31m"0;18"[m[31m;[m
		[01;34mwhen[m Key_F                 [31m=>[m [01;34mreturn[m [31m"0;33"[m[31m;[m
		[01;34mwhen[m Key_G                 [31m=>[m [01;34mreturn[m [31m"0;34"[m[31m;[m
		[01;34mwhen[m Key_H                 [31m=>[m [01;34mreturn[m [31m"0;35"[m[31m;[m
		[01;34mwhen[m Key_I                 [31m=>[m [01;34mreturn[m [31m"0;23"[m[31m;[m
		[01;34mwhen[m Key_J                 [31m=>[m [01;34mreturn[m [31m"0;36"[m[31m;[m
		[01;34mwhen[m Key_K                 [31m=>[m [01;34mreturn[m [31m"0;37"[m[31m;[m
		[01;34mwhen[m Key_L                 [31m=>[m [01;34mreturn[m [31m"0;38"[m[31m;[m
		[01;34mwhen[m Key_M                 [31m=>[m [01;34mreturn[m [31m"0;50"[m[31m;[m
		[01;34mwhen[m Key_N                 [31m=>[m [01;34mreturn[m [31m"0;49"[m[31m;[m
		[01;34mwhen[m Key_O                 [31m=>[m [01;34mreturn[m [31m"0;24"[m[31m;[m
		[01;34mwhen[m Key_P                 [31m=>[m [01;34mreturn[m [31m"0;25"[m[31m;[m
		[01;34mwhen[m Key_Q                 [31m=>[m [01;34mreturn[m [31m"0;16"[m[31m;[m
		[01;34mwhen[m Key_R                 [31m=>[m [01;34mreturn[m [31m"0;19"[m[31m;[m
		[01;34mwhen[m Key_S                 [31m=>[m [01;34mreturn[m [31m"0;31"[m[31m;[m
		[01;34mwhen[m Key_T                 [31m=>[m [01;34mreturn[m [31m"0;20"[m[31m;[m
		[01;34mwhen[m Key_U                 [31m=>[m [01;34mreturn[m [31m"0;22"[m[31m;[m
		[01;34mwhen[m Key_V                 [31m=>[m [01;34mreturn[m [31m"0;47"[m[31m;[m
		[01;34mwhen[m Key_W                 [31m=>[m [01;34mreturn[m [31m"0;17"[m[31m;[m
		[01;34mwhen[m Key_X                 [31m=>[m [01;34mreturn[m [31m"0;45"[m[31m;[m
		[01;34mwhen[m Key_Y                 [31m=>[m [01;34mreturn[m [31m"0;21"[m[31m;[m
		[01;34mwhen[m Key_Z                 [31m=>[m [01;34mreturn[m [31m"0;44"[m[31m;[m
		[01;34mwhen[m Key_1                 [31m=>[m [01;34mreturn[m [31m"0;120"[m[31m;[m
		[01;34mwhen[m Key_2                 [31m=>[m [01;34mreturn[m [31m"0;121"[m[31m;[m
		[01;34mwhen[m Key_3                 [31m=>[m [01;34mreturn[m [31m"0;122"[m[31m;[m
		[01;34mwhen[m Key_4                 [31m=>[m [01;34mreturn[m [31m"0;123"[m[31m;[m
		[01;34mwhen[m Key_5                 [31m=>[m [01;34mreturn[m [31m"0;124"[m[31m;[m
		[01;34mwhen[m Key_6                 [31m=>[m [01;34mreturn[m [31m"0;125"[m[31m;[m
		[01;34mwhen[m Key_7                 [31m=>[m [01;34mreturn[m [31m"0;126"[m[31m;[m
		[01;34mwhen[m Key_8                 [31m=>[m [01;34mreturn[m [31m"0;126"[m[31m;[m
		[01;34mwhen[m Key_9                 [31m=>[m [01;34mreturn[m [31m"0;127"[m[31m;[m
		[01;34mwhen[m Key_0                 [31m=>[m [01;34mreturn[m [31m"0;129"[m[31m;[m
		[01;34mwhen[m Key_Minus             [31m=>[m [01;34mreturn[m [31m"0;130"[m[31m;[m
		[01;34mwhen[m Key_Equal             [31m=>[m [01;34mreturn[m [31m"0;131"[m[31m;[m
		[01;34mwhen[m Key_Left_Square       [31m=>[m [01;34mreturn[m [31m"0;26"[m[31m;[m
		[01;34mwhen[m Key_Right_Square      [31m=>[m [01;34mreturn[m [31m"0;27"[m[31m;[m
		[01;34mwhen[m Key_Space             [31m=>[m [01;34mreturn[m [31m"0;43"[m[31m;[m
		[01;34mwhen[m Key_Semicolon         [31m=>[m [01;34mreturn[m [31m"0;39"[m[31m;[m
		[01;34mwhen[m Key_Single_Quote      [31m=>[m [01;34mreturn[m [31m"0;40"[m[31m;[m
		[01;34mwhen[m Key_Comma             [31m=>[m [01;34mreturn[m [31m"0;51"[m[31m;[m
		[01;34mwhen[m Key_Dot               [31m=>[m [01;34mreturn[m [31m"0;52"[m[31m;[m
		[01;34mwhen[m Key_Slash             [31m=>[m [01;34mreturn[m [31m"0;53"[m[31m;[m
		[01;34mwhen[m Key_Left_Single_Quote [31m=>[m [01;34mreturn[m [31m"(0;41)"[m[31m;[m
		[01;34mwhen[m Keypad_Enter          [31m=>[m [01;34mreturn[m [31m"(0;166)"[m[31m;[m
		[01;34mwhen[m Keypad_Slash          [31m=>[m [01;34mreturn[m [31m"(0;74)"[m[31m;[m
		[01;34mwhen[m Keypad_Star           [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mwhen[m Keypad_Minus          [31m=>[m [01;34mreturn[m [31m"(0;164)"[m[31m;[m
		[01;34mwhen[m Keypad_Plus           [31m=>[m [01;34mreturn[m [31m"(0;55)"[m[31m;[m
		[01;34mwhen[m Keypad_Middle         [31m=>[m [01;34mraise[m Illegal_Keystroke[31m;[m
		[01;34mend[m [01;34mcase[m[31m;[m
	[01;34mend[m[31m;[m

	[01;34mfunction[m [01;30mKeystroke_String_Code[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 [32mWide_String[m
	[01;34mis[m
	[01;34mbegin[m
		[01;34mcase[m Modifier_Key [01;34mis[m
		[01;34mwhen[m No_Modifier_Key [31m=>[m
		   [01;34mreturn[m [01;30mKey_String_Code_Whith_No_Modifier_Key[m [31m([mKey[31m);[m
		[01;34mwhen[m Shift_Key [31m=>[m [01;34mreturn[m [01;30mKey_String_Code_Whith_Shift_Key[m [31m([mKey[31m);[m
		[01;34mwhen[m Ctrl_Key  [31m=>[m [01;34mreturn[m [01;30mKey_String_Code_Whith_Ctrl_Key[m [31m([mKey[31m);[m
		[01;34mwhen[m Alt_Key   [31m=>[m [01;34mreturn[m [01;30mKey_String_Code_Whith_Alt_Key[m [31m([mKey[31m);[m
		[01;34mend[m [01;34mcase[m[31m;[m
	[01;34mend[m[31m;[m

	[31m-- Procedure for assigning key-stroke to string[m
	[31m-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[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
	[01;34mis[m
	[01;34mbegin[m
		[01;34mcase[m Modifier_Key [01;34mis[m
		[01;34mwhen[m No_Modifier_Key [31m=>[m
			[01;34mcase[m Key [01;34mis[m
			[01;34mwhen[m Key_Print_Screen      [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_Pause_Break       [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m [01;34mothers[m [31m=>[m [01;34mreturn[m True[31m;[m
			[01;34mend[m [01;34mcase[m[31m;[m
		[01;34mwhen[m Shift_Key [31m=>[m
			[01;34mcase[m Key [01;34mis[m
			[01;34mwhen[m Key_Print_Screen      [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_Pause_Break       [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_Enter             [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_Null              [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Keypad_Enter          [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m [01;34mothers[m [31m=>[m [01;34mreturn[m True[31m;[m
			[01;34mend[m [01;34mcase[m[31m;[m
		[01;34mwhen[m Ctrl_Key [31m=>[m
			[01;34mcase[m Key [01;34mis[m
			[01;34mwhen[m Key_Null              [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_1                 [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_2                 [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_3                 [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_4                 [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_5                 [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_6                 [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_7                 [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_8                 [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_9                 [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_0                 [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_Equal             [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_Semicolon         [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_Single_Quote      [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_Slash             [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_Left_Single_Quote [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m [01;34mothers[m [31m=>[m [01;34mreturn[m True[31m;[m
			[01;34mend[m [01;34mcase[m[31m;[m
		[01;34mwhen[m Alt_Key [31m=>[m
			[01;34mcase[m Key [01;34mis[m
			[01;34mwhen[m Keypad_Home           [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Keypad_Up_Arrow       [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Keypad_Page_Up        [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Keypad_Left_Arrow     [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Keypad_Right_Arrow    [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Keypad_End            [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Keypad_Down_Arrow     [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Keypad_Page_Down      [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Keypad_Insert         [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Keypad_Delete         [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_Print_Screen      [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_Pause_Break       [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Key_Null              [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Keypad_Star           [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m Keypad_Middle         [31m=>[m [01;34mreturn[m False[31m;[m
			[01;34mwhen[m [01;34mothers[m [31m=>[m [01;34mreturn[m True[31m;[m
			[01;34mend[m [01;34mcase[m[31m;[m
		[01;34mend[m [01;34mcase[m[31m;[m
	[01;34mend[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;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[31m-- Maximum string length : 1 + 1 + maximum-code-length + 1 =[m
		[31m-- 1 + 1 + 9 + 1 = 12[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [01;30mKeystroke_String_Code[m [31m([mKey[31m,[m Modifier_Key[31m));[m
		[01;30mAppend[m [31m([mB[31m,[m [31m';'[m[31m);[m
		[01;30mPut[m [31m([mB[31m);[m
		[01;30mPut_Command_String[m [31m([mSubstitution[31m);[m
		[01;30mPut_Command_String[m [31m([m[31m"p"[m[31m);[m
	[01;34mend[m[31m;[m

	[01;34mprocedure[m [01;30mAssign_Keystroke[m [31m([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;34mis[m
		B [31m:[m Buffer_Type[31m;[m
	[01;34mbegin[m
		[01;30mStart[m [31m([mB[31m);[m
		[01;30mAppend[m [31m([mB[31m,[m [01;30mKeystroke_String_Code[m [31m([mKey[31m,[m Modifier_Key[31m));[m
		[01;30mAppend[m [31m([mB[31m,[m [31m';'[m[31m);[m
		[01;30mPut[m [31m([mStream[31m,[m B[31m);[m
		[01;30mPut_Command_String[m [31m([mStream[31m,[m Substitution[31m);[m
		[01;30mPut_Command_String[m [31m([mStream[31m,[m [31m"p"[m[31m);[m
	[01;34mend[m[31m;[m

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