File : os.ads


   1 ------------------------------------------------------------------------------
   2 ------------------------------------------------------------------------------
   3 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'.               --
   4 --                                                                          --
   5 -- (C) 2019 Stanislav Datskovskiy ( www.loper-os.org )                      --
   6 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html     --
   7 --                                                                          --
   8 -- You do not have, nor can you ever acquire the right to use, copy or      --
   9 -- distribute this software ; Should you use this software for any purpose, --
  10 -- or copy and distribute it to anyone or in any manner, you are breaking   --
  11 -- the laws of whatever soi-disant jurisdiction, and you promise to         --
  12 -- continue doing so for the indefinite future. In any case, please         --
  13 -- always : read and understand any software ; verify any PGP signatures    --
  14 -- that you use - for any purpose.                                          --
  15 --                                                                          --
  16 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm .     --
  17 ------------------------------------------------------------------------------
  18 ------------------------------------------------------------------------------
  19 
  20 with Interfaces;   use Interfaces;
  21 with Interfaces.C; use Interfaces.C;
  22 
  23 
  24 package OS is
  25    
  26    -- Receive a character from the TTY, and True if success (False if EOF)
  27    function Read_Char(C : out Character) return Boolean;
  28    
  29    -- Send a character to the TTY.
  30    procedure Write_Char(C : in Character);
  31    
  32    -- Send a Newline to the TTY.
  33    procedure Write_Newline;
  34    
  35    -- Send a String to the TTY.
  36    procedure Write_String(S : in String);
  37    
  38    -- Exit with an error condition report.
  39    procedure Eggog(M : String);
  40    
  41    procedure Quit(Return_Code : Integer);
  42    pragma Import
  43      (Convention    => C,
  44       Entity        => Quit,
  45       External_Name => "exit");
  46    
  47 private
  48    
  49    -- POSIX stdio:   
  50    EOF : constant int := -1;
  51 
  52    function GetChar return int;
  53    pragma Import(C, getchar);
  54    
  55    function PutChar(item: int) return int;
  56    pragma Import(C, putchar);
  57    
  58    -- GNATistic
  59    procedure To_Stderr(C : Character);
  60    pragma Import(Ada, To_Stderr, "__gnat_to_stderr_char");
  61    
  62    Sadness_Code : constant Integer := -1;
  63    
  64 end OS;