[BACK]Return to numbers_io.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Numbers

File: [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Numbers / numbers_io.adb (download)

Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:26 2000 UTC (23 years, 7 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 text_io,integer_io;                 use text_io,integer_io;
with Standard_Floating_Numbers_io;       use Standard_Floating_Numbers_io;

package body Numbers_io is

  procedure Read_Positive ( p : out positive ) is
  begin
    get(p); skip_line;
  exception
    when DATA_ERROR | CONSTRAINT_ERROR =>
      skip_line;  -- skip the rubbish
      put("This is not a positive number, try again : ");
      Read_Positive(p);
  end Read_Positive;

  procedure Read_Natural ( n : out natural ) is
  begin
    get(n); skip_line;
  exception
    when DATA_ERROR | CONSTRAINT_ERROR =>
      skip_line;  -- skip the rubbish
      put("This is not a natural number, try again : ");
      Read_Natural(n);
  end Read_Natural;

  procedure Read_Integer ( i : out integer ) is
  begin
    get(i); skip_line;
  exception
    when DATA_ERROR | CONSTRAINT_ERROR =>
      skip_line;  -- skip the rubbish
      put("This is not an integer number, try again : ");
      Read_Integer(i);
  end Read_Integer;

  procedure Read_Single_Float ( f : out single_float ) is
  begin
    get(f); skip_line;
  exception
    when DATA_ERROR | CONSTRAINT_ERROR =>
      skip_line;  -- skip the rubbish
      put("This is not a floating point number, try again : ");
      Read_Single_Float(f);
  end Read_Single_Float;

  procedure Read_Double_Float ( f : out double_float ) is
  begin
    get(f); skip_line;
  exception
    when DATA_ERROR | CONSTRAINT_ERROR =>
      skip_line;  -- skip the rubbish
      put("This is not a floating point number, try again : ");
      Read_Double_Float(f);
  end Read_Double_Float;

end Numbers_io;