spawn_glib_23.0.0_440f8b8a/source/spawn/spawn-internal__glib.ads

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--
--  Copyright (C) 2018-2022, AdaCore
--
--  SPDX-License-Identifier: Apache-2.0
--

with Ada.Finalization;

with Glib.Main;
with Glib.Spawn;

with Spawn.Channels;

private package Spawn.Internal is

   package Environments is

      function "=" (Left, Right : UTF_8_String) return Boolean;
      function "<" (Left, Right : UTF_8_String) return Boolean;

   end Environments;

   type Pipe_Kinds is (Stdin, Stdout, Stderr);

   type Process is tagged;

   type Process_Reference is record
      Self : access Process'Class;
   end record;
   --  A wrapper to pass process pointer to C binding functions

   type Process is
     abstract new Ada.Finalization.Limited_Controlled with record
      Reference : aliased Process_Reference;
      Channels  : Spawn.Channels.Channels (Process'Unchecked_Access);
      Event     : Glib.Main.G_Source_Id := 0;
      pid       : aliased Glib.Spawn.GPid := 0;
   end record;

   procedure Emit_Stdin_Available (Self : in out Process) is abstract;

   procedure Emit_Stdout_Available (Self : in out Process) is abstract;

   procedure Emit_Stderr_Available (Self : in out Process) is abstract;

   procedure Emit_Error_Occurred
     (Self          : in out Process;
      Process_Error : Integer) is abstract;

   procedure On_Close_Channels (Self : in out Process) is null;
   --  This callback is called when last channel is closed

end Spawn.Internal;