4.2.34. GNATCOLL.OS.Process_Types (unix)

package GNATCOLL.OS.Process_Types is

   package UTF8 renames Ada.Strings.UTF_Encoding;

   --  Unix process handle
   type Process_Handle is new Integer;
   Invalid_Handle : constant Process_Handle;

   --------------------------
   --  Process environment --
   --------------------------

   type Environ is limited private;
   --  Represent environment passed to a child process

   Case_Sensitive_Env_Var_Names : constant Boolean := True;

   procedure Inherit (Env : in out Environ);
   --  Call inherit to force parent process environment inheritance. When
   --  calling Inherit, all previous call to Set_Variable and/or Import are
   --  ignored.

   procedure Import (Env : in out Environ);
   --  Import current process environment into Env. Env can then be modified
   --  using Set_Variable.

   procedure Set_Variable
      (Env   : in out Environ;
       Name  : UTF8.UTF_8_String;
       Value : UTF8.UTF_8_String);
   --  Set variable Name to Value in Env.

   function As_C (Env : Environ) return C_String_Array;
   --  Export Env as an array of pointers to null terminated strings,
   --  terminated by a null pointer. Each element is of the form "name=value"

   procedure Deallocate (Env : in out Environ);
   --  Deallocate Env.

   -----------------------
   -- Process arguments --
   -----------------------

   type Arguments is limited private;
   --  Represent arguments, including the command used to spawn a process

   procedure Add_Argument
      (Args : in out Arguments;
       Arg  : UTF8.UTF_8_String);
   --  Add an argument Arg to Args.

   function Program (Args : Arguments) return UTF8.UTF_8_String;
   --  Return the first argument of Args which correspond to the program name

   function Program (Args : Arguments) return C_String;
   --  Return the first argument of Args which correspond to the program name

   function As_C (Args : Arguments) return C_String_Array;
   --  Export Env as an array of pointers to null terminated strings

   procedure Deallocate (Args : in out Arguments);
   --  Deallocate Args

end GNATCOLL.OS.Process_Types;