File: [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Numbers / multprec_integer_numbers_io.adb (download)
Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:26 2000 UTC (23 years, 10 months ago) by maekawa
Branch: PHC, MAIN
CVS Tags: v2, maekawa-ipv6, RELEASE_1_2_3, RELEASE_1_2_2_KNOPPIX_b, RELEASE_1_2_2_KNOPPIX, RELEASE_1_2_2, RELEASE_1_2_1, HEAD Changes since 1.1: +0 -0
lines
Import the second public release of PHCpack.
OKed by Jan Verschelde.
|
with integer_io; use integer_io;
with Characters_and_Numbers; use Characters_and_Numbers;
with Multprec_Natural_Numbers; use Multprec_Natural_Numbers;
with Multprec_Natural_Numbers_io; use Multprec_Natural_Numbers_io;
package body Multprec_Integer_Numbers_io is
procedure get ( lc : in out character; i : in out Integer_Number ) is
begin
get(Standard_Input,lc,i);
end get;
procedure get ( file : in file_type;
lc : in out character; i : in out Integer_Number ) is
n : Natural_Number;
plus : boolean;
begin
if lc = ' '
then Skip_Spaces(file,lc);
end if;
if lc = '+'
then plus := true;
get(file,lc);
elsif lc = '-'
then plus := false;
get(file,lc);
else plus := true;
end if;
get(file,lc,n);
Clear(i);
i := Create(n);
if not plus
then Min(i);
end if;
end get;
procedure get ( i : in out Integer_Number ) is
begin
get(Standard_Input,i);
end get;
procedure get ( file : in file_type; i : in out Integer_Number ) is
c : character := ' ';
begin
Skip_Spaces(file,c);
get(file,c,i);
end get;
procedure put ( i : in Integer_Number ) is
begin
put(Standard_Output,i);
end put;
procedure put ( file : in file_type; i : in Integer_Number ) is
begin
if Empty(i)
then put(file,"0");
else if Negative(i)
then put(file,"-");
end if;
put(file,Unsigned(i));
end if;
end put;
procedure put ( i : in Integer_Number; dp : in natural ) is
begin
put(Standard_Output,i,dp);
end put;
procedure put ( file : in file_type;
i : in Integer_Number; dp : in natural ) is
begin
if Empty(i)
then for k in 1..dp-1 loop
put(file," ");
end loop;
put(file,"0");
else if Negative(i)
then for k in 1..dp-Decimal_Places(i)-1 loop
put(file," ");
end loop;
put(file,"-");
put(file,Unsigned(i));
else put(file,Unsigned(i),dp);
end if;
put(file,Unsigned(i));
end if;
end put;
end Multprec_Integer_Numbers_io;