------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- You do not have, nor can you ever acquire the right to use, copy or -- -- distribute this software ; Should you use this software for any purpose, -- -- or copy and distribute it to anyone or in any manner, you are breaking -- -- the laws of whatever soi-disant jurisdiction, and you promise to -- -- continue doing so for the indefinite future. In any case, please -- -- always : read and understand any software ; verify any PGP signatures -- -- that you use - for any purpose. -- -- -- -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Version for use with C run time with Ada.Text_IO; use Ada.Text_IO; package body Ada.Integer_Text_IO is --------- -- Put -- --------- procedure Put (X : Integer) is Neg_X : Integer; S : String (1 .. Integer'Width); First : Natural := S'Last + 1; Val : Integer; begin -- Work on negative values to avoid overflows Neg_X := (if X < 0 then X else -X); loop -- Cf RM 4.5.5 Multiplying Operators. The rem operator will return -- negative values for negative values of Neg_X. Val := Neg_X rem 10; Neg_X := (Neg_X - Val) / 10; First := First - 1; S (First) := Character'Val (Character'Pos ('0') - Val); exit when Neg_X = 0; end loop; if X < 0 then First := First - 1; S (First) := '-'; end if; Put (S (First .. S'Last)); end Put; end Ada.Integer_Text_IO;