comp.lang.ada
 help / color / mirror / Atom feed
From: GDAU100@BGUVM.BITNET ("Jonathan B. Owen")
Subject: TEXT_IO anomality
Date: 25 Jul 90 07:03:32 GMT	[thread overview]
Message-ID: <9007241309.AA00417@ajpo.sei.cmu.edu> (raw)


1. When using TEXT_IO procedures and function without a file parameter,
   STANDARD_INPUT and STANDARD_OUTPUT are used according to the
   type of service (i.e. Get or Put, mainly).

   Unlike the clarity of the above defaults, the SET_COL and COL
   functions apply both to standard input and output.  As far as
   I know, these services without a file parameter default to
   STANDARD_OUTPUT.  Is this mentioned or defined in the LRM?

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.  This causes
   a difficulty when output relys on first obtaining this value and
   using it for printing multiple lines at specific column.  Since
   first line is printed at column 1 even though counter is not so.
   Attempting to do a TEXT_IO.SET_COL( TEXT_IO.COL ) will not work,
   since this will have no effect.

   Also, if you would like to correct the COL counter of STANDARD_OUTPUT
   by doing SET_COL(1), so it will be in accord to the screen cursor,
   you will result with a blank line (assuming that the counter was
   greater than 1).

   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

______________________________________________________________________________
  (--)    /--)     /-(\                 Email: gdau100@bguvm (bitnet)
  \ /    /--K      | \|/\   /\/) /|-\   Snail: 55 Hovevei Zion
  _/_/o /L__)_/o \/\__/  \X/  \_/ | |_/        Tel-Aviv, 63346  ISRAEL
 (/        Jonathan B. Owen             Voice: (03) 281-422

 Point of view:  A chicken is the means by which an egg reproduces an egg.
______________________________________________________________________________

             reply	other threads:[~1990-07-25  7:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1990-07-25  7:03 "Jonathan B. Owen" [this message]
1990-07-25 17:14 ` TEXT_IO anomality 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
  -- 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