comp.lang.ada
 help / color / mirror / Atom feed
From: madmats@elcgl.epfl.ch ("", Mats Weber)
Subject: TEXT_IO anomality
Date: 26 Jul 90 14:32:00 GMT	[thread overview]
Message-ID: <RFC-822:900726153238.3fn@sic.epfl.ch> (raw)

RFC-822-Headers:
Received: from elcgl.epfl.ch by SIC.Epfl.CH with VMSmail ; Thu, 26 Jul 90 15:32:38 N
X-ST-Vmsmail-To: gw::"info-ada@ajpo.sei.cmu.edu"
gw::"gdau100@bguvm"

==================
>   Here's a demonstrations of the problem:
> 
>        Put("Prompt> ");  Get_line(buffer, last_pos);
> 
>        declare
>            c : TEXT_IO.Count := TEXT_IO.COL;
>        begin
>            for i in 1..5
>            loop
>                -- Adding here Set_col(c) will do nothin in Verdix Ada
>                -- since delta between c and TEXT_IO.COL is zero!
> 
>                Put_line("All lines should start from same column!");
>                TEXT_IO.Set_col(c);
>            end loop;
>        end;
> 
>    Output will look like this:
> 
>        Prompt> Humph <CR>
>        All lines should start from same column!
>                All lines should start from same column!
>                All lines should start from same column!
>                All lines should start from same column!
>                All lines should start from same column!
> 
> 
>                        Any thoughts? Comments?  Suggestions?
> 
>                                    Jonathan B. Owen

This behavior is required by the LRM because the page, line and column 
counts are a property of the internal file object, not the external file 
(which, in this case, is the terminal).

The preceding piece of code actually manipulates two file objects 
(Current_Output and Current_Input) which are independant from the point of 
view of the Ada program, but are associated with the same external device 
(the terminal). As a consequence, reading "Humph" from Current_Input does 
not change the column count of Current_Output.

Note that the language does not even require that Puts to Current_Output 
and Gets from Current_Input be synchronized, i.e. the string "Prompt> " 
might not appear before the call to Get_Line.

I don't think Text_IO is well suited for reading/writing to or from a 
terminal.

Mats Weber
Swiss Federal Institute of Technology
EPFL DI LGL
1015 Lausanne
Switzerland

E-mail : madmats@elcgl.epfl.ch
phone  : +41 21 693 52 92
fax    : +41 21 693 39 09

             reply	other threads:[~1990-07-26 14:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1990-07-26 14:32 "", Mats Weber [this message]
  -- strict thread matches above, loose matches on Subject: below --
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
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
replies disabled

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