File : fz_io.ads


   1 ------------------------------------------------------------------------------
   2 ------------------------------------------------------------------------------
   3 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'.               --
   4 --                                                                          --
   5 -- (C) 2018 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 Words;    use Words;
  21 with FZ_Type;  use FZ_Type;
  22 with FZ_Lim;   use FZ_Lim;
  23 
  24 
  25 package FZ_IO is
  26    
  27    pragma Pure;
  28    
  29    -- Expand FZ N by nibble D, and determine whether this operation overflowed
  30    procedure FZ_Insert_Bottom_Nibble(N        : in out FZ;
  31                                      D        : in     Nibble;
  32                                      Overflow : out    WBool);
  33       
  34    -- A count of ASCII chars representing a humanized FZ:
  35    subtype Char_Count is
  36      Positive range Nibbleness * FZ_Minimal_Wordness .. Positive'Last;
  37    
  38    -- Determine the number of ASCII characters required to represent N
  39    function FZ_ASCII_Length(N : in FZ) return Char_Count;
  40    pragma Inline_Always(FZ_ASCII_Length);
  41    
  42    -- Hex Digits (currently used only in FZ_To_Hex_String)
  43    HexDigs : constant array(0 .. 15) of Character := "0123456789ABCDEF";
  44    
  45    -- Write an ASCII hex representation of N into existing string buffer S
  46    procedure FZ_To_Hex_String(N : in FZ; S : out String)
  47      with Pre => S'Length = FZ_ASCII_Length(N);
  48    
  49 end FZ_IO;