-- 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-10-11 17:08:46 ; 
-- Version := 0.47.0a ; 
with Ada.Strings.Wide_Unbounded;
with M.Strings;
use M.Strings;
with Ada.Unchecked_Deallocation;
with Gnat.os_Lib;
use Gnat.Os_Lib;
with Adam.Results;
--use Adam.Results;
with M.Results;
--use M.Results;
package M.Tools is
   
   
   --  type Result_Enum is (File, Search, Spawn);
   
   --  type Result_Record (Name : Result_Enum) is tagged
   --     record
   --  	 Wlines : U_Array_Access;
   --  	 Count  : Natural := 0;
   --  	 Initialized : Boolean := False;
   --  	 case Name is
   --  	    when File =>
   --  	       null;
   --  	    when Search =>
   --  	       Pattern   : Wide_String_Access := new Wide_String ' ("");
   --  	       Address   : String_Access;
   --  	       Doc_Name  : Wide_String_Access;
   --  	    when Spawn =>
   --  	       Process_Id     : Gnat.Os_Lib.Process_Id;
   --  	       Program_Name   : U_String;
   --  	       Args           : Argument_List_Access;	 
   --  	       Output_File    : U_String;
   --  	       Success        : Boolean := False;
   --  	       Return_Code    : Integer := 0;
   --  	       Err_To_Out     : Boolean := False;	 
   --  	 end case;
	 
   --     end record;   
   function Integer_Image (Value : in Integer) return String;
   function Spawn(Line : in String; Filename : in String) return M.Results.Result_Record;
   

   
   
   function Delete_Local_Prefix(Filename : in String) return String;
   function Normalize_Quoted_Argument(Arg : in String) return String;
   function Search_Regexp (Path : in String;
                           Pattern : in String) return String;
   function Expand_filename (Line : in String) return String;
   procedure Change_directory (Line : in String;Old_Pwd : in out String_Access);
   procedure Find_At_Path (Path : in String;
			   Pattern : in String;
			   Result : in M.Results.Wide_Result_Access);
   procedure Completion (Line : in String;
			 Full_Command : out Wide_String_Access;
			 Result : out M.Results.Wide_Result_Access);
   
   function Shell_Spawn(Line : in String) return Adam.Results.Spawn_Result_Type;

   

   
   
   
   
   Local_Prefix : constant String := "./";

end M.Tools ;