-
+ 634128D0E47D0243E992295EEEF1D98EA1AD00A2B4B7B5619066EC0380FAF8D2A569C463B208F1C9AB288CCC6373E4766F058A83C51C503AA610B28F056C028A
zfp/adainclude/a-inteio.adb
(0 . 0)(1 . 54)
10 ------------------------------------------------------------------------------
11 ------------------------------------------------------------------------------
12 -- You do not have, nor can you ever acquire the right to use, copy or --
13 -- distribute this software ; Should you use this software for any purpose, --
14 -- or copy and distribute it to anyone or in any manner, you are breaking --
15 -- the laws of whatever soi-disant jurisdiction, and you promise to --
16 -- continue doing so for the indefinite future. In any case, please --
17 -- always : read and understand any software ; verify any PGP signatures --
18 -- that you use - for any purpose. --
19 -- --
20 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
21 ------------------------------------------------------------------------------
22 ------------------------------------------------------------------------------
23
24 -- Version for use with C run time
25 with Ada.Text_IO; use Ada.Text_IO;
26
27 package body Ada.Integer_Text_IO is
28
29 ---------
30 -- Put --
31 ---------
32
33 procedure Put (X : Integer) is
34 Neg_X : Integer;
35 S : String (1 .. Integer'Width);
36 First : Natural := S'Last + 1;
37 Val : Integer;
38
39 begin
40 -- Work on negative values to avoid overflows
41
42 Neg_X := (if X < 0 then X else -X);
43
44 loop
45 -- Cf RM 4.5.5 Multiplying Operators. The rem operator will return
46 -- negative values for negative values of Neg_X.
47
48 Val := Neg_X rem 10;
49 Neg_X := (Neg_X - Val) / 10;
50 First := First - 1;
51 S (First) := Character'Val (Character'Pos ('0') - Val);
52 exit when Neg_X = 0;
53 end loop;
54
55 if X < 0 then
56 First := First - 1;
57 S (First) := '-';
58 end if;
59
60 Put (S (First .. S'Last));
61 end Put;
62
63 end Ada.Integer_Text_IO;