[BACK]Return to ts_commuser.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / System

Annotation of OpenXM_contrib/PHC/Ada/System/ts_commuser.adb, Revision 1.1.1.1

1.1       maekawa     1: with text_io;                            use text_io;
                      2: with Communications_with_User;           use Communications_with_User;
                      3:
                      4: procedure ts_commuser is
                      5:
                      6: -- DESCRIPTION :
                      7: --   Tests the dialogues with the user.
                      8:
                      9:   procedure Create_and_Write is
                     10:
                     11:     file : file_type;
                     12:     c : character;
                     13:
                     14:   begin
                     15:     put_line("Reading the name of an output file.");
                     16:     Read_Name_and_Create_File(file);
                     17:     put("Give a character : "); get(c);
                     18:     put(file,c);
                     19:     Close(file);
                     20:   end Create_and_Write;
                     21:
                     22:   procedure Open_and_Read is
                     23:
                     24:     file : file_type;
                     25:     c : character;
                     26:
                     27:   begin
                     28:     put_line("Reading the name of an input file.");
                     29:     Read_Name_and_Open_File(file);
                     30:     get(file,c);
                     31:     put("The first character read : "); put(c); new_line;
                     32:     Close(file);
                     33:   end Open_and_Read;
                     34:
                     35:   procedure Main is
                     36:
                     37:     ans : character;
                     38:
                     39:   begin
                     40:     loop
                     41:       put_line("Choose one of the following :");
                     42:       put_line("  0. Exit: leave this menu.");
                     43:       put_line("  1. Create an output file and write a character to it.");
                     44:       put_line("  2. Open an file for input and read a first character.");
                     45:       put("Make your choice : "); Ask_Alternative(ans,"012");
                     46:       case ans is
                     47:         when '1' => Create_and_Write;
                     48:         when '2' => Open_and_Read;
                     49:         when others => null;
                     50:       end case;
                     51:       put("Do you want more tests ? (y/n) "); Ask_Yes_or_No(ans);
                     52:       exit when (ans /= 'y');
                     53:     end loop;
                     54:   end Main;
                     55:
                     56: begin
                     57:   Main;
                     58: end ts_commuser;

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