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

Annotation of OpenXM_contrib/PHC/Ada/Math_Lib/Numbers/numbers_io.adb, Revision 1.1

1.1     ! maekawa     1: with text_io,integer_io;                 use text_io,integer_io;
        !             2: with Standard_Floating_Numbers_io;       use Standard_Floating_Numbers_io;
        !             3:
        !             4: package body Numbers_io is
        !             5:
        !             6:   procedure Read_Positive ( p : out positive ) is
        !             7:   begin
        !             8:     get(p); skip_line;
        !             9:   exception
        !            10:     when DATA_ERROR | CONSTRAINT_ERROR =>
        !            11:       skip_line;  -- skip the rubbish
        !            12:       put("This is not a positive number, try again : ");
        !            13:       Read_Positive(p);
        !            14:   end Read_Positive;
        !            15:
        !            16:   procedure Read_Natural ( n : out natural ) is
        !            17:   begin
        !            18:     get(n); skip_line;
        !            19:   exception
        !            20:     when DATA_ERROR | CONSTRAINT_ERROR =>
        !            21:       skip_line;  -- skip the rubbish
        !            22:       put("This is not a natural number, try again : ");
        !            23:       Read_Natural(n);
        !            24:   end Read_Natural;
        !            25:
        !            26:   procedure Read_Integer ( i : out integer ) is
        !            27:   begin
        !            28:     get(i); skip_line;
        !            29:   exception
        !            30:     when DATA_ERROR | CONSTRAINT_ERROR =>
        !            31:       skip_line;  -- skip the rubbish
        !            32:       put("This is not an integer number, try again : ");
        !            33:       Read_Integer(i);
        !            34:   end Read_Integer;
        !            35:
        !            36:   procedure Read_Single_Float ( f : out single_float ) is
        !            37:   begin
        !            38:     get(f); skip_line;
        !            39:   exception
        !            40:     when DATA_ERROR | CONSTRAINT_ERROR =>
        !            41:       skip_line;  -- skip the rubbish
        !            42:       put("This is not a floating point number, try again : ");
        !            43:       Read_Single_Float(f);
        !            44:   end Read_Single_Float;
        !            45:
        !            46:   procedure Read_Double_Float ( f : out double_float ) is
        !            47:   begin
        !            48:     get(f); skip_line;
        !            49:   exception
        !            50:     when DATA_ERROR | CONSTRAINT_ERROR =>
        !            51:       skip_line;  -- skip the rubbish
        !            52:       put("This is not a floating point number, try again : ");
        !            53:       Read_Double_Float(f);
        !            54:   end Read_Double_Float;
        !            55:
        !            56: end Numbers_io;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>