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

File: [local] / OpenXM_contrib / PHC / Ada / System / ts_commuser.adb (download)

Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:34 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;                            use text_io;
with Communications_with_User;           use Communications_with_User;

procedure ts_commuser is

-- DESCRIPTION :
--   Tests the dialogues with the user.

  procedure Create_and_Write is

    file : file_type;
    c : character;

  begin
    put_line("Reading the name of an output file.");
    Read_Name_and_Create_File(file);
    put("Give a character : "); get(c);
    put(file,c);
    Close(file);
  end Create_and_Write;

  procedure Open_and_Read is

    file : file_type;
    c : character;

  begin
    put_line("Reading the name of an input file.");
    Read_Name_and_Open_File(file);
    get(file,c);
    put("The first character read : "); put(c); new_line;
    Close(file);
  end Open_and_Read;

  procedure Main is
  
    ans : character;

  begin
    loop
      put_line("Choose one of the following :");
      put_line("  0. Exit: leave this menu.");
      put_line("  1. Create an output file and write a character to it.");
      put_line("  2. Open an file for input and read a first character.");
      put("Make your choice : "); Ask_Alternative(ans,"012");
      case ans is
        when '1' => Create_and_Write;
        when '2' => Open_and_Read;
        when others => null;
      end case;
      put("Do you want more tests ? (y/n) "); Ask_Yes_or_No(ans);
      exit when (ans /= 'y');
    end loop;
  end Main;

begin
  Main;
end ts_commuser;