-- main is main file of main project written with Ada. -- Main is Copyright (C) 2025 Manuel De Girardi ;  -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA -- -- Date := 2026-09-17 22:48:49 ;  -- Version := 0.39.0a ;  with M ; with M.Errors ; with M.Parameters ; with M.Options ; with M.Versions; with M.Versions.Version_Io; with M.Enums ; with M.Types ; with M.Interfaces ; with M.Agence ; with M.Ansi.Console ; with M.Ansi.Windows ; with M.Windows ; with M.Shared ; with M.Account; with M.Accounts_Manager; use M.Account; use M.Accounts_Manager; with Ada.Wide_Text_Io ; with Ada.Characters.Handling ; with Ada.Text_Io; use Ada; with Ada.Strings.Wide_Fixed; use Ada.Strings.Wide_Fixed; with Ada.Calendar; with Ada.Calendar.Formatting; use Ada.Calendar; with Gnat.Os_Lib; with Gnat.Directory_Operations; use Gnat.Directory_Operations; with M.Logs; with M.Balance; with Sky; with M.Projects_Manager; use M.Projects_Manager; with M.Accountant; with Sky.Stocks_Manager; with M.Project; with M.WOPR; with M.Servers; with El.Lexics; with El.Hander; use El; with M.Engineering; with Gnat.Semaphores; use Gnat; with Lib.Shared; procedure Main is use M.Accounts_Manager.Operation_Vectors; use M ; use M.Errors ; use M.Parameters ; use M.Versions; use M.Interfaces ; use M.Shared ; use M.Ansi.Console ; use Ada.Characters ; use Gnat.Os_Lib; use M.Logs; use Sky; use M.Accountant; use Sky.Stocks_Manager; use M.Project; package W_Io renames Ada.Wide_Text_Io; File : Wide_Text_Io.File_Type; Last : Natural := 1; Next : Natural := 1; Lines : M.Line_Range := 67; Columns : M.Column_Range := 240; The_Style : M.Style_Enum := M.Color_And_Color; Mode : M.Mode_Enum := M.None; End_Of_Program : Boolean := False; Int : Interface_Record; Max_Words : Natural := 1023; Key_Lock : Semaphores.Binary_Semaphore(True, Semaphores.Default_Ceiling); function System(Line : in String) return Integer; pragma Import (C, System, "system"); Errno : Integer := 0; begin Initialize(Int); declare Help_Parameter : constant Parameters.Parameter_Record := Get_Parameter(Int, Help); Version_Parameter : constant Parameters.Parameter_Record := Get_Parameter(Int, M.Version); Initialize_Parameter : constant Parameters.Parameter_Record := Get_Parameter(Int, Initialize); Geometry_Parameter : constant Parameters.Parameter_Record := Get_Parameter(Int, Geometry); Style_Parameter : constant Parameters.Parameter_Record := Get_Parameter(Int, Style); Total_Parameter : constant Parameters.Parameter_Record := Get_Parameter(Int, Total); Add_Parameter : constant Parameters.Parameter_Record := Get_Parameter(Int, Add); Remove_Parameter : constant Parameters.Parameter_Record := Get_Parameter(Int, Remove); begin Text_Io.Put_Line("Going to set parameters..."); if Help_Parameter.Is_Setted then Interfaces.Parameters_Descriptions(Int); M.WOPR.Message_Box.Halt; return; else if Version_Parameter.Is_Setted then Text_Io.Put_Line(Versions.Version_Io.To_String(Versions.Version)); M.WOPR.Message_Box.Halt; return; end if; end if; Interfaces.Print_Parameters(Int); if Initialize_Parameter.Is_Setted then Total_Sum := Total_Type'Value(Handling.To_String(Initialize_Parameter.Value.all)); M.WOPR.Message_Box.Halt; return; end if; if Add_Parameter.Is_Setted then Total_Sum := Total_Type'Value(Handling.To_String(Add_Parameter.Value.all)); M.WOPR.Message_Box.Halt; return; end if; if Remove_Parameter.Is_Setted then Total_Sum := Total_Type'Value(Handling.To_String(Remove_Parameter.Value.all)); M.WOPR.Message_Box.Halt; return; end if; if Total_Parameter.Is_Setted then Text_Io.Put_Line(Total_Type'Image(Total_Sum)); M.WOPR.Message_Box.Halt; return; end if; if Geometry_Parameter.Is_Setted then Lines := Lines_Number(Geometry_Parameter.Value.all); Columns := Columns_Number(Geometry_Parameter.Value.all); end if; if Style_Parameter.Is_Setted then begin The_style := Style_Enum'value(Handling.To_String(Style_Parameter.Value.all)); exception when others => Text_Io.Put_Line("Style error : not an style"); raise; end; end if; end; Text_Io.Put_Line("Going to make Agence..."); declare subtype Word_Type is Lexical_Range range 0..Max_words; package Words_Glossary is new Lexics.Glossary(Word_Type); use Words_Glossary; Words : Glossary_Type; begin declare package hander is new El.hander ( Glossary_Filename => "glossary.txt", Width_Line => 80, Max_Words => Max_words, Samples_Max => 144, Network_Filename => "elhoim", Word_Type => Word_Type, Glossary => Words_Glossary ); use Projects_Manager.Projects_Dll; package Ansi_Windows is new M.Ansi.Windows (Lines, Columns); package Windows is new M.Windows (Lines, Columns, The_Style, Ansi_Windows); package Main_Agence is new M.Agence (Ansi_Windows, Windows, Hander, Words_Glossary); use Main_Agence; use M; use Hander; use Main_Agence.Servers; begin Game_Restore; delay 2.0; Server.Initialize; Server.Start; App.Started := True; App.Lines := Lines; App.Columns := Columns; Functions := (0 => new None_Record(App'Access), 1 => new Organizer_Record(App'Access), 2 => new Vbrain_Record(App'Access), 3 => new Planning_Record(App'Access), 4 => new Manager_Record(App'Access), 5 => new Moneybox_Record(App'Access), 6 => new Activity_Record(App'Access), 7 => new Stocks_Record(App'Access), 8 => new Bank_Record(App'Access), 9 => new Logs_Record(App'Access), 10 => new Menu_Record(App'Access), 11 => new Contacts_Record(App'Access), 12 => new Library_Record(App'Access), 13 => new Master_Record(App'Access), 14 => new Engine_Record(App'Access), 15 => new Devel_Record(App'Access), 16 => new WOPR_Record(App'Access), 17 => new Workstation_Record(App'Access), 18 => new Space_Fighter_Record(App'Access), 19 => new Person_Record(App'Access), 20 => new World_Record(App'Access), 21 => null, 22 => null, 23 => null, 24 => null, 25 => null, 26 => null, 27 => new All_Manuals_Record(App'Access), 28 => new Shell_Record(App'Access), 29 => new Self_Development_Record(App'Access), 30 => null, 31 => new Audits_Record(App'Access), 32 => null, 33 => null, 34 => null, 35 => new Auth_Record(App'Access), 36 => new Gate_Record(App'Access), others => null); Text_Io.Put_Line("Going to Term initialization..."); begin App.Term := M.Term_Enum'Value(Getenv("TERM").all); exception when Constraint_Error => App.Term := fvwm; end; begin Make_Dir("Archives"); exception when others => begin Change_Dir("Archives"); Change_Dir(".."); exception when others => raise Spec_Error; end; end; Text_Io.Put_Line("Going to restore Organizer..."); if Is_Regular_File(Organizer_Filename) then Restore(App.Terminal, Organizer_Filename); end if; Text_Io.Put_Line("Going to set App.Initialized..."); if Balance.Initialized or (Balance.Balance.Capital > 0.0) then App.Initialized := True; end if; Text_Io.Put_Line("initialized"); Text_Io.Put_Line("Going to restore Billed..."); if Is_Regular_File("billed.txt") then Invoices_Restore(Accounts.Billed, Accounts.Invoice_Last, "billed.txt"); end if; Text_Io.Put_Line("Going to restore Charged..."); if Is_Regular_File("charged.txt") then Outvoices_Restore(Accounts.Charges, Accounts.Outvoice_Last, "charged.txt"); end if; Text_Io.Put_Line("Going to set App.Initialized..."); if Balance.Created or (Balance.Main_Balance.Capital > 0.0) then App.Created := True; end if; --Text_Io.Put_Line("initialized"); Text_Io.Put_Line("Going to restore Billed..."); if Is_Regular_File("main_billed.txt") then Invoices_Restore(Main_Accounts.Billed, Main_Accounts.Invoice_Last, "main_billed.txt"); end if; Text_Io.Put_Line("Going to restore Charged..."); if Is_Regular_File("main_charged.txt") then Outvoices_Restore(Main_Accounts.Charges, Main_Accounts.Outvoice_Last, "main_charged.txt"); end if; Text_Io.Put_Line("Loading stocks..."); Stocks_Restore; Text_Io.Put_Line("Done."); --------------------------------------------- -- Bank Wide_Text_Io.Open(File, Wide_Text_Io.In_File, Bank_Filename, Form => "WCEM=8"); while not Wide_Text_Io.End_Of_File(File) loop declare Line : Wide_String := Wide_Text_Io.Get_Line(File); Op : Operation_Record; begin Next := Index(Line, "" & Wide_Character'Val(9)); Op.Label := new Wide_String ' (Line(Line'First..Next-1)); Last := Next + 1; Next := Index(Line, "" & Wide_Character'Val(9), last); Op.Date_Op := Formatting.Value(Handling.To_String(Line(Last..Next-1))); Last := Next + 1; Next := Index(Line, "" & Wide_Character'Val(9), Last); Op.Date_Val := Formatting.Value(Handling.To_String(Line(Last..Next-1))); Last := Next + 1; Op.sum := Sum_Range'Value(Handling.To_String(Line(Last..Line'last))); App.Bank.List := App.Bank.List & Op; App.Bank.Total := App.Bank.Total + Op.Sum; end; end loop; Wide_Text_Io.Close(File); if Is_Regular_File("Projects.lst") then Text_Io.Put_Line("Loading Projects.lst.."); Projects_Manager.Manager_Load(App.Projects, "Projects.lst"); Text_Io.Put_Line("Done."); end if; Errno := System("/usr/bin/cat Projects.lst"); if Is_Regular_File("Archives/Projects.lst") then Text_Io.Put_Line("Loading Archives/Projects.lst.."); Projects_Manager.Archives_Load(App.Archives, "Archives/Projects.lst"); Text_Io.Put_Line("Done."); end if; ------------------------------------------------ -- Logs if Is_Regular_File(M.Logs.Log_Filename) then M.Logs.Restore(App.logs, M.Logs.Log_Filename); end if; Append(App.Projects.List, new Project_Record ' (Null_Project)); Text_Io.Put_Line("Initialise CPU..."); Cpu_Process.Initialize; Text_Io.Put_Line("CPU ok!"); App.Console.Initialize; Text_Io.Put_Line("Console ok!"); App.Console.Switch(Auth); Devel_Record(functions(Mode_Enum'Pos(Devel)).all).State := True; App.Console.Switch(Devel); --App.Console.Switch(Menu); loop declare Wchar : Wide_Character := Wide_Character ' Val(0); begin case App.Term is when M.Linux => begin Key_Lock.Seize; App.Console.Mode(Mode); Key_Lock.Release; W_Io.Get_Immediate(Wchar); --Matrix_Saver.Suspend; case Wchar is when Wide_Character'Val(27) => Key_Lock.Seize; App.Console.Set_On_Esc(True); Key_Lock.Release; W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(27) => case Mode is when Organizer .. Log => Key_Lock.Seize; App.Console.Reset; Key_Lock.Release; when Gate => App.Console.Set_On_Esc(False); Ansi.Console.Clear_Screen; App.Console.Switch(Quit); End_Of_Program := True; when Menu => App.Console.Set_On_Esc(False); Ansi.Console.Clear_Screen; Lib.Shared.Line_Cur := 1; App.Console.Switch(none); End_Of_Program := True; when none => App.Console.Set_On_Esc(False); Ansi.Console.Clear_Screen; App.Console.Switch(Gate); End_Of_Program := False; when Quit => App.Console.Switch(Auth); App.Console.Halt; exit; when others => if End_Of_Program then --App.Console.Switch(Quit); Key_Lock.Seize; App.Console.Halt; Key_Lock.Release; exit; end if; end case; when others => Key_Lock.Seize; App.Console.Mode(Mode); Key_Lock.Release; case Mode is when Quit => if End_Of_Program then --App.Console.Switch(Quit); App.Console.Switch(Auth); App.Console.Halt; exit; end if; when others => App.Console.Set_On_Esc(False); --App.Console.Switch(mode); End_Of_Program := False; end case; end case; case Wchar is when Wide_Character'Val(91) => W_Io.Get_Immediate(Wchar); Key_Lock.Seize; App.Console.Set_On_Esc(False); Key_Lock.Release; case Wchar is when Wide_Character'Val(49) => W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(55) => null;-- Text_Io.Put_Line(" -- F6"); Key_Lock.Seize; App.Console.Switch(Activity); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(56) => null;-- Text_Io.Put_Line(" -- F7"); Key_Lock.Seize; App.Console.Switch(Stocks); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(57) => null;-- Text_Io.Put_Line(" -- F8"); Key_Lock.Seize; App.Console.Switch(Bank); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(126) => null;-- Text_Io.Put_Line(" -- begin"); Key_Lock.Seize; App.Console.Begin_Of; Key_Lock.Release; when others => null; end case; when Wide_Character'Val(50) => W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(48) => null;-- Text_Io.Put_Line(" -- F9"); Key_Lock.Seize; App.Console.Switch(Log); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(49) => null;-- Text_Io.Put_Line(" -- F10"); Key_Lock.Seize; App.Console.Switch(Menu); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(51) => null;-- Text_Io.Put_Line(" -- F11"); Key_Lock.Seize; App.Console.Switch(Contacts); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(52) => null;-- Text_Io.Put_Line(" -- F12"); Key_Lock.Seize; App.Console.Switch(Library); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(53) => null; W_Io.Put_Line(" -- Maj+F1"); Key_Lock.Seize; App.Console.Switch(Navigation); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(54) => null; W_Io.Put_Line(" -- Maj+F2"); Key_Lock.Seize; App.Console.Switch(Engineer); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(56) => null; W_Io.Put_Line(" -- Maj+F3"); W_Io.Get_Immediate(Wchar); Key_Lock.Seize; App.Console.Switch(Devel); Key_Lock.Release; when Wide_Character'Val(57) => null; W_Io.Put_Line(" -- Maj+F4"); W_Io.Get_Immediate(Wchar); Key_Lock.Seize; App.Console.Switch(Admin); Key_Lock.Release; when Wide_Character'Val(126) => null;-- Text_Io.Put_Line(" -- insert");  Key_Lock.Seize; App.Console.Overwrite; Key_Lock.Release; when others => null; end case; when Wide_Character'Val(51) => W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(49) => -- Maj+F5 Key_Lock.Seize; App.Console.Switch(Terminator); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(50) => -- Maj+F6 Key_Lock.Seize; App.Console.Switch(Joshua); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(51) => -- Maj+F7 Key_Lock.Seize; App.Console.Switch(Entreprise); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(52) => -- Maj+F8 Key_Lock.Seize; App.Console.Switch(Process); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(126) => -- Del Key_Lock.Seize; App.Console.Del; Key_Lock.Release; when others => null; end case; when Wide_Character'Val(52) => null;-- Text_Io.Put_Line(" -- end");  W_Io.Get_Immediate(Wchar); Key_Lock.Seize; App.Console.End_Of; Key_Lock.Release; when Wide_Character'Val(53) => null;-- Text_Io.Put_Line(" -- page up"); Key_Lock.Seize; App.Console.Page_Up; Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(54) => null;-- Text_Io.Put_Line(" -- page down"); Key_Lock.Seize; App.Console.Page_Down; Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(65) => null;-- Text_Io.Put_Line(" -- up"); Key_Lock.Seize; App.Console.Up_Arrow; Key_Lock.Release; when Wide_Character'Val(66) => null;-- Text_Io.Put_Line(" -- down"); Key_Lock.Seize; App.Console.Down_Arrow; Key_Lock.Release; when Wide_Character'Val(67) => null;-- Text_Io.Put_Line(" -- right"); Key_Lock.Seize; App.Console.Right_Arrow; Key_Lock.Release; when Wide_Character'Val(68) => null;-- Text_Io.Put_Line(" -- left"); Key_Lock.Seize; App.Console.Left_Arrow; Key_Lock.Release; when Wide_Character'Val(91) => W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(65) => null;-- Text_Io.Put_Line(" -- F1");  Key_Lock.Seize; App.Console.Switch(Organizer); Key_Lock.Release; when Wide_Character'Val(66) => null;-- Text_Io.Put_Line(" -- F2"); Key_Lock.Seize; App.Console.Switch(Dialog); Key_Lock.Release; when Wide_Character'Val(67) => null;-- Text_Io.Put_Line(" -- F3");  Key_Lock.Seize; App.Console.Switch(Planning); Key_Lock.Release; when Wide_Character'Val(68) => null;-- Text_Io.Put_Line(" -- F4"); Key_Lock.Seize; App.Console.Switch(Manager); Key_Lock.Release; when Wide_Character'Val(69) => null;-- Text_Io.Put_Line(" -- F5"); Key_Lock.Seize; App.Console.Switch(Moneybox); Key_Lock.Release; when others => null; end case; when others => Key_Lock.Seize; App.Console.Reset; Key_Lock.Release; End_Of_Program := False; Key_Lock.Seize; App.Console.Receive(Wchar); Key_Lock.Release; end case; when others => Key_Lock.Seize; App.Console.Set_On_Esc(False); Key_Lock.Release; end case; when others => case Mode is when Quit => -- uncomment this line ! Key_Lock.Seize; App.Console.Switch(none); Key_Lock.Release; null; when others => null; end case; Key_Lock.Seize; App.Console.Set_On_Esc(False); Key_Lock.Release; End_Of_Program := False; Key_Lock.Seize; App.Console.Receive(Wchar); Key_Lock.Release; end case; exception when W_Io.End_Error => --Bell(Quiet); delay 0.5; Key_Lock.Seize; App.Console.reset; Key_Lock.Release; end; when M.fvwm => begin Key_Lock.Seize; App.Console.Mode(Mode); Key_Lock.Release; W_Io.Get_Immediate(Wchar); --Matrix_Saver.Suspend; case Wchar is when Wide_Character'Val(27) => Key_Lock.Seize; App.Console.Set_On_Esc(True); Key_Lock.Release; W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(27) => case Mode is when Organizer .. Log => Key_Lock.Seize; App.Console.Reset; Key_Lock.Release; when Gate => App.Console.Set_On_Esc(False); Ansi.Console.Clear_Screen; App.Console.Switch(Quit); End_Of_Program := True; when Menu => App.Console.Set_On_Esc(False); Ansi.Console.Clear_Screen; Lib.Shared.Line_Cur := 1; App.Console.Switch(none); End_Of_Program := True; when none => App.Console.Set_On_Esc(False); Ansi.Console.Clear_Screen; App.Console.Switch(Gate); End_Of_Program := False; when Quit => App.Console.Switch(Auth); App.Console.Halt; exit; when others => if End_Of_Program then --App.Console.Switch(Quit); Key_Lock.Seize; App.Console.Halt; Key_Lock.Release; exit; end if; end case; when others => Key_Lock.Seize; App.Console.Mode(Mode); Key_Lock.Release; case Mode is when Quit => if End_Of_Program then --App.Console.Switch(Quit); App.Console.Switch(Auth); App.Console.Halt; exit; end if; when others => App.Console.Set_On_Esc(False); --App.Console.Switch(mode); End_Of_Program := False; end case; end case; case Wchar is when Wide_Character'Val(79) => W_Io.Get_Immediate(Wchar); Key_Lock.Seize; App.Console.Set_On_Esc(False); Key_Lock.Release; case Wchar is when Wide_Character'Val(80) => null;-- Text_Io.Put_Line(" -- F1");  Key_Lock.Seize; App.Console.Switch(Organizer); Key_Lock.Release; when Wide_Character'Val(81) => null;-- Text_Io.Put_Line(" -- F2"); Key_Lock.Seize; App.Console.Switch(Dialog); Key_Lock.Release; when Wide_Character'Val(82) => null;-- Text_Io.Put_Line(" -- F3");  Key_Lock.Seize; App.Console.Switch(Planning); Key_Lock.Release; when Wide_Character'Val(83) => null;-- Text_Io.Put_Line(" -- F4"); Key_Lock.Seize; App.Console.Switch(Manager); Key_Lock.Release; when others => null; end case; when Wide_Character'Val(91) => Key_Lock.Seize; App.Console.Set_On_Esc(False); Key_Lock.Release; W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(49) => W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(53) => W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(126) => null;-- Text_Io.Put_Line(" -- F5");  Key_Lock.Seize; App.Console.Switch(Moneybox); Key_Lock.Release; when others => W_Io.Get_Immediate(Wchar); W_Io.Get_Immediate(Wchar); Key_Lock.Seize; App.Console.Switch(Terminator); -- Maj+F5 Key_Lock.Release; end case; when Wide_Character'Val(55) => W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(126) => null;-- Text_Io.Put_Line(" -- F6"); Key_Lock.Seize; App.Console.Switch(Activity); Key_Lock.Release; when others => W_Io.Get_Immediate(Wchar); W_Io.Get_Immediate(Wchar); Key_Lock.Seize; App.Console.Switch(Joshua); -- Maj+F6 Key_Lock.Release; end case; when Wide_Character'Val(56) => W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(126) => null;-- Text_Io.Put_Line(" -- F7"); Key_Lock.Seize; App.Console.Switch(Stocks); Key_Lock.Release; when others => W_Io.Get_Immediate(Wchar); W_Io.Get_Immediate(Wchar); Key_Lock.Seize; App.Console.Switch(Entreprise); -- Maj+F6 Key_Lock.Release; end case; when Wide_Character'Val(57) => null;-- Text_Io.Put_Line(" -- F8"); W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(126) => Key_Lock.Seize; App.Console.Switch(Bank); Key_Lock.Release; when others => W_Io.Get_Immediate(Wchar); W_Io.Get_Immediate(Wchar); Key_Lock.Seize; App.Console.Switch(Process); -- Maj+F6 Key_Lock.Release; end case; when Wide_Character'Val(59) => W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(50) => W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(80) => null;W_Io.Put_Line(" -- Maj+F1"); Key_Lock.Seize; App.Console.Switch(Navigation); Key_Lock.Release; when Wide_Character'Val(81) => null;W_Io.Put_Line(" -- Maj+F2"); Key_Lock.Seize; App.Console.Switch(Engineer); Key_Lock.Release; when Wide_Character'Val(82) => null;W_Io.Put_Line(" -- Maj+F3"); Key_Lock.Seize; App.Console.Switch(Devel); Key_Lock.Release; when Wide_Character'Val(83) => null;W_Io.Put_Line(" -- Maj+F4"); Key_Lock.Seize; App.Console.Switch(Admin); Key_Lock.Release; when others => null; end case; when others => null; end case; when others => null; end case; when Wide_Character'Val(50) => W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(48) => null;-- Text_Io.Put_Line(" -- F9"); Key_Lock.Seize; App.Console.Switch(Log); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(49) => null;-- Text_Io.Put_Line(" -- F10"); Key_Lock.Seize; App.Console.Switch(Menu); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(51) => null;-- Text_Io.Put_Line(" -- F11"); Key_Lock.Seize; App.Console.Switch(Contacts); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(52) => --null;Text_Io.Put_Line(" -- F12"); Key_Lock.Seize; App.Console.Switch(Library); Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(126) => Key_Lock.Seize; App.Console.Overwrite; Key_Lock.Release; null;-- Text_Io.Put_Line(" -- insert"); when others => null; end case; when Wide_Character'Val(51) => null;-- Text_Io.Put_Line(" -- del");  Key_Lock.Seize; App.Console.Del; Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(53) => null;-- Text_Io.Put_Line(" -- page up"); Key_Lock.Seize; App.Console.Page_Up; Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(54) => null;-- Text_Io.Put_Line(" -- page down"); Key_Lock.Seize; App.Console.Page_Down; Key_Lock.Release; W_Io.Get_Immediate(Wchar); when Wide_Character'Val(65) => null;-- Text_Io.Put_Line(" -- up"); Key_Lock.Seize; App.Console.Up_Arrow; Key_Lock.Release; when Wide_Character'Val(66) => null;-- Text_Io.Put_Line(" -- down"); Key_Lock.Seize; App.Console.Down_Arrow; Key_Lock.Release; when Wide_Character'Val(67) => null;-- Text_Io.Put_Line(" -- right"); Key_Lock.Seize; App.Console.Right_Arrow; Key_Lock.Release; when Wide_Character'Val(68) => null;-- Text_Io.Put_Line(" -- left"); Key_Lock.Seize; App.Console.Left_Arrow; Key_Lock.Release; when Wide_Character'Val(70) => --Text_Io.Put_Line(" -- end"); Key_Lock.Seize; App.Console.End_Of; Key_Lock.Release; when Wide_Character'Val(72) => null;-- Text_Io.Put_Line(" -- begin");  Key_Lock.Seize; App.Console.Begin_Of; Key_Lock.Release; when Wide_Character'Val(91) => W_Io.Get_Immediate(Wchar); case Wchar is when Wide_Character'Val(69) => -- screen print ? W_Io.Get_Immediate(Wchar); when others => null; end case; when others => Key_Lock.Seize; App.Console.Reset; Key_Lock.Release; End_Of_Program := False; Key_Lock.Seize; App.Console.Receive(Wchar); Key_Lock.Release; end case; when others => Key_Lock.Seize; App.Console.Set_On_Esc(False); Key_Lock.Release; end case; when others => case Mode is when Quit => Key_Lock.Seize; App.Console.Switch(none); Key_Lock.Release; when others => null; end case; Key_Lock.Seize; App.Console.Set_On_Esc(False); Key_Lock.Release; End_Of_Program := False; Key_Lock.Seize; App.Console.Receive(Wchar); Key_Lock.Release; end case; exception -- A la saisie de Ctrl+D End Error is raised. when W_Io.End_Error => --Bell(Quiet); delay 0.5; Key_Lock.Seize; App.Console.reset; Key_Lock.Release; end; end case; end; end loop; --App.Config_Proc.Halt(End_Of_Program); if Integer(Length(App.Bank.List)) /= 0 then Wide_Text_Io.Create(File, Wide_Text_Io.Out_File, Bank_Filename, Form => "WCEM=8"); for I in 1..Length(App.Bank.List) loop declare Op : Operation_Record := Element(App.Bank.List, Integer(I)); begin Wide_Text_Io.Put_Line(File, Op.Label.all & Wide_Character'Val(9) & Handling.To_Wide_String(Formatting.Image(Op.Date_Op)) & Wide_Character'Val(9) & Handling.To_Wide_String(Formatting.Image(Op.Date_val)) & Wide_Character'Val(9) & Handling.To_Wide_String(Sum_Range'Image(Op.sum))); end; end loop; Wide_Text_Io.Close(File); end if; Save(App.Terminal.root, Organizer_Filename); Projects_Manager.Manager_Save(App.Projects, "Projects.lst"); Projects_Manager.Archives_Save(App.Archives, "Archives/Projects.lst"); Stocks_Save; M.Logs.save(App.logs, M.Logs.Log_Filename); W_Io.Put_Line("Halting CPU process..."); Cpu_Process.Halt; W_Io.Put_Line("CPU process halted."); Main_Agence.Servers.Game_Save; W_Io.Put_Line("Halting message box"); M.WOPR.Message_Box.Halt; W_Io.Put_Line("Halting Servers"); Main_Agence.Servers.Ctrl_C_Procedure; exception when W_Io.End_Error => Cpu_Process.Halt; Main_Agence.Servers.Game_Save; M.WOPR.Message_Box.Halt; Main_Agence.Servers.Ctrl_C_Procedure; end; end; end Main ;