comp.lang.ada
 help / color / mirror / Atom feed
From: hilfingr@tully.Berkeley.EDU (Paul Hilfinger)
Subject: Re: TEXT_IO anomality
Date: 26 Jul 90 06:54:29 GMT	[thread overview]
Message-ID: <26496@pasteur.Berkeley.EDU> (raw)
In-Reply-To: 2020@cod.NOSC.MIL



|>
|>>2. When doing a Get_line, the user terminates input by pressing <CR>.
|>>   This moves the screen cursor to Col 1 of the following line (and
|>>   the COL counter of STANDARD_INPUT is updated accordingly).  Still,
|>>   the COL counter of STANDARD_OUTPUT remains as before.
|>
|>     Very interesting.  I've verified that VAX Ada behaves the same way.
|>In a quick skim through the LRM I saw nothing that explicitly required
|>this behaviour.  (It could be there and I just missed it.)  In section
|>14.3.5 (3) is the statement "All procedures GET and PUT maintain the
|>current column, line, and page numbers of the specified file: ...".  I
|>wonder if implementors have jumped to the conclusion that only these
|>procedures, along with SET_LINE and SET_COL, can affect those numbers?
|>In looking at the titles of the 800+ issues considered by the ARG, it
|>appears that this question has never come up.  In the absence of an
|>explicit requirement to the contrary, I consider this to be a misimple-
|>mentation.  If your cursor is blinking at column 40 and you ask what
|>the column of STANDARD_OUTPUT is, any answer other than 40 is wrong.
|>(Even in the presence of an explicit requirement any answer other than
|>40 is wrong, but it just might not be possible to fix it.)
|>
|>                              Charlie Sampson
                                      
Leaving aside the question of whether the behavior is desirable, it is 
definitely correct.  14.3(6) indicates how terminators may find their way
into a file; it only mentions operations on the file itself (and "file",
by the way, always means "internal file" in this chapter, not "external
file", such as the actual contents of one's screen).  14.3(8) indicates
that it is these terminators that are counted when determining the value
of LINE---regardless of any other effects on the external file. 
14.3.5(3) indicates that GET, PUT, etc., maintain the column, line, and
page numbers of the "specified file", and not some other random file
unmentioned in the statement.  Finally, the Note 14.1(13) indicates that
the effect of sharing the same "bidirectional" device between several
file objects is implementation-dependent.

Furthermore, I think that changing the behavior of TEXT_IO to take
account of interactions between input and output on a terminal would be a very
bad idea.  It would mean, one presumes, that the runtime system would have
to maintain implicit links between files that read and write from 
terminals; that every write to a terminal would involve first checking
for input from the terminal (so as to get the correct final values for
LINE and COL); and a few other implications I have undoubtably missed.

Paul N. Hilfinger, (member ARG, URG, and Ada 9X Distinguished Reviewers)
Computer Science Division				
Dept. of Electrical Engineering and Computer Sciences
University of California
Berkeley, CA  94720
Hilfinger@Berkeley.EDU
(415) 642-8401

  reply	other threads:[~1990-07-26  6:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1990-07-25  7:03 TEXT_IO anomality "Jonathan B. Owen"
1990-07-25 17:14 ` Charles H. Sampson
1990-07-26  6:54   ` Paul Hilfinger [this message]
1990-07-26 15:02     ` Vinod Grover
1990-07-28  1:20       ` Danford Lehman
1990-08-06 19:44     ` Charles H. Sampson
1990-08-13  9:32       ` Mike Harrison
  -- strict thread matches above, loose matches on Subject: below --
1990-07-26 14:32 "", Mats Weber
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox