-- 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 := "2025-06-11 16:46:44"
-- Version := "0.0.0r"
with Ada.Characters.Handling;
use Ada.Characters.Handling;
with Ada.Calendar.Formatting;
use Ada.Calendar.Formatting;
with M.Ansi.Console;
use M.Ansi.Console;
with Text_Io;
use Text_Io;
with Gnat.Os_Lib;
use Gnat.Os_Lib;
with Ada.Unchecked_Deallocation;

package body M.Engine is
   procedure String_Free is new Ada.Unchecked_Deallocation(String, String_Access);
      function Same (Left, Right : in Element_Access) return Boolean is
   begin
      return Left.all = Right.all;
   end Same;
   
   procedure Obj_Free(O : in out Element_Access) is
   begin
      Wide_Free(O.Info.Name);
      if O.Definition.Index /= 0 then
	 for Att in 1..O.Definition.Index loop
	    if O.Definition.List(Att).Enum = Str then
	       String_Free(O.Definition.List(Att).Str);
	    end if;
	 end loop;
      end if;
      
	      
   end Obj_Free;

   
   procedure Print (Info : Element_Info; header : in Window_Type) is
   begin
      
      Draw(Header, 1, 2, White, "Class : " & To_Wide_String(Element_Enum'Image(Info.Tag)));
      Draw(Header, 2, 2, White, "Index : " & To_Wide_String(Element_Index'Image(Info.Index)));
      if Info.Name /= null then
	 Draw(Header, 3, 2, White, "Name : " & Info.Name.all);
      else
	 Draw(Header, 3, 2, White, "Name : ");
      end if;
      Draw(Header, 4, 2, White, "Created : " & To_Wide_String(Image(Info.Created)));
   end Print;
   
   
   procedure Print (Obj    : in None_Class;
		    Header : in Window_Type;
		    Main : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in None_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out None_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;

   
   
   procedure Print (Attr : in Attributs; Win : in Window_type) is
   begin      

      if Attr.Index /= 0 then

	 for I in 1..Attr.Index loop
	    Draw(Win, I, 1, white, To_Wide_String(Attr.List(I).Name.all));
	    Draw(Win, I, Attr.List(I).Name'Length+1, Red, "=");
	    Draw(Win, I, Attr.List(I).Name'Length+2, white, To_Wide_String(Attr.List(I).Value.all));
	 end loop;
      end if;
   end Print;
      
   procedure Print (Obj    : in Program_Class;
		    Header : in Window_Type;
		    Main : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in Program_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out Program_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;
   
   procedure Print (Obj    : in Description_Class;
		    Header : in Window_Type;
		    Main : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in Description_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out Description_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;
   
   procedure Print (Obj    : in License_Class;
		    Header : in Window_Type;
		    Main : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in License_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out License_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;
   
   procedure Print (Obj    : in Main_Class;
		    Header : in Window_Type;
		    Main : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in Main_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out Main_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;

   procedure Print (Obj    : in Library_Class;
		    Header : in Window_Type;
		    Library : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in Library_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out Library_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;
   
   
   
   procedure Print (Obj    : in Axiomatic_Class;
		    Header : in Window_Type;
		    Axiomatic : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in Axiomatic_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out Axiomatic_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;
   
   procedure Print (Obj    : in Precondition_Class;
		    Header : in Window_Type;
		    Precondition : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in Precondition_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out Precondition_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;
   
   procedure Print (Obj    : in Axiom_Class;
		    Header : in Window_Type;
		    Axiom : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in Axiom_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out Axiom_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;
   
   procedure Print (Obj    : in Predicate_Class;
		    Header : in Window_Type;
		    Predicate : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in Predicate_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out Predicate_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;
   
   procedure Print (Obj    : in Condition_Class;
		    Header : in Window_Type;
		    Condition : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in Condition_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out Condition_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;
   
   procedure Print (Obj    : in Component_Class;
		    Header : in Window_Type;
		    Component : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in Component_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out Component_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;
   
   procedure Print (Obj    : in Action_Class;
		    Header : in Window_Type;
		    Action : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in Action_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out Action_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;
   
   procedure Print (Obj    : in Class_Class;
		    Header : in Window_Type;
		    Class : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in Class_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out Class_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;
   
   procedure Print (Obj    : in Machine_Class;
		    Header : in Window_Type;
		    Machine : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in Machine_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out Machine_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;
   
   procedure Print (Obj    : in System_Class;
		    Header : in Window_Type;
		    System : in Window_Type) is
   begin
      null;
   end Print;
   
   procedure Write (O : in System_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Write;
   procedure Read (O : out System_Class;File : in W_Io.File_Type) is
   begin
      null;
   end Read;
   

   
   use Element_Vectors;

end M.Engine ;