Path: utzoo!attcan!uunet!mcvax!unido!fkihh!marcus
From: marcus@fkihh.UUCP (Marcus Moehrmann)
Newsgroups: comp.lang.ada
Subject: TEXT_IO
Message-ID: <340@fkihh.UUCP>
Date: 11 May 88 16:46:51 GMT
Reply-To: marcus@fkihh.UUCP (Marcus Moehrmann)
Organization: Uni Hamburg/FRG, FB Informatik, AB Natuerlichsprachliche Systeme
Lines: 42
Posted: Wed May 11 17:46:51 1988

Hello,
I have a question concerning TEXT_IO. Consider the following program:

with TEXT_IO;
use  TEXT_IO;
procedure TEST is
begin
--   SET_INPUT  (STANDARD_INPUT);    -- (1)
--   SET_OUTPUT (STANDARD_OUTPUT);   -- (1)
   DO_SOMETHING;
   PUT_LINE ("After doing something");   -- (2)
end TEST;

Now, LRM 14.3(5) states, that the standard IO files are open *at the
beginning* of the program execution and have the appropriate modes.

But what has to be done, if they cannot be opened because of
NAME_ERROR or USE_ERROR ? E.g. with VAX/VMS you can do the following:
   $ DEFINE ADA$OUTPUT 
and something equal for ADA$INPUT. After that STANDARD_OUTPUT cannot
be opened at the beginning of the program execution. I think, the same
can be done in other operating-systems like UNIX or MS/DOS.

Now the question is, *when* to raise the IO error, e.g. NAME_ERROR ?
During elaboration of TEXT_IO, at first use of STANDARD_IO ?

This is what happens with VAX Ada V1.4-33:

   If statements (1) are active, NAME_ERROR will be raised here 

   If statement (1) are commented out, NAME_ERROR will be raised at (2),
   after doing something else.
   
Therefor in Vax Ada statements (1) are neccessary to prevent doing
something after the beginning of the program execution but befor an IO
statement is reached. I feel, that there must not be a difference if
statements (1) are active or not (commented out).


*** Marcus Moehrmann                |  UUCP:    marcus@fkihh.UUCP ***
*** (TeX: M\"{o}hrmann)             |  PHONE:   +49-40-4123-2573  ***
*** Univ of Hamburg, W. Germany     |           +49-40-5202464    ***