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    -- Warn operator re: potentially-dangerous condition.
  42    procedure Achtung(M : String);
  43    
  44    procedure Quit(Return_Code : Integer);
  45    pragma Import
  46      (Convention    => C,
  47       Entity        => Quit,
  48       External_Name => "exit");
  49    
  50    -- Result Codes for Termination
  51    Yes_Code : constant Integer :=  1;
  52    No_Code  : constant Integer :=  0;
  53    Mu_Code  : constant Integer := -1;
  54    Sad_Code : constant Integer := -2;
  55    
  56 private
  57    
  58    -- POSIX stdio:   
  59    EOF : constant int := -1;
  60 
  61    function GetChar return int;
  62    pragma Import(C, getchar);
  63    
  64    function PutChar(item: int) return int;
  65    pragma Import(C, putchar);
  66    
  67    -- GNATistic
  68    procedure To_Stderr(C : Character);
  69    pragma Import(Ada, To_Stderr, "__gnat_to_stderr_char");
  70    
  71 end OS;