From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!elcgl.epfl.ch!madmats From: madmats@elcgl.epfl.ch ("", Mats Weber) Newsgroups: comp.lang.ada Subject: TEXT_IO anomality Message-ID: Date: 26 Jul 90 14:32:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet List-Id: 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 > 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