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 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ff34bb99bda04ad7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-13 04:24:01 PST Newsgroups: comp.lang.ada Path: bga.com!news.sprintlink.net!howland.reston.ans.net!xlink.net!snert!subnet.sub.net!rz.uni-karlsruhe.de!news.uni-stuttgart.de!news.belwue.de!news.informatik.uni-stuttgart.de!spiegel From: spiegel@bruessel.informatik.uni-stuttgart.de (Andre Spiegel) Subject: Re: GOTOXY in Ada ? In-Reply-To: daver@Starbase.NeoSoft.COM's message of 8 Dec 1994 22:19:38 -0600 [ 09 Dec 1994 05:19:38 MET ] Message-ID: Sender: news@informatik.uni-stuttgart.de Organization: University of Stuttgart, Germany References: <3c4a9a$1lts@obelix.uni-muenster.de> <1994Dec8.080423.3368@sei.cmu.edu> <3c8lsq$rhu@Starbase.NeoSoft.COM> Date: Tue, 13 Dec 1994 10:09:21 GMT Date: 1994-12-13T10:09:21+00:00 List-Id: Dave Retherford writes: [ suggestion to position the cursor using Text_IO.Set_Col, Set_Line ] > Of course this will only give you cursor control at a character > positioning level. Also, this works with whatever the standard output > file (or rather default one) which in most cases will be the screen (at > least it is on the compilers I use). I wonder if what you say here is clear enough; let me stress that this is almost certainly not what the original poster wanted, because Set_Col and Set_Line can only *advance* the cursor, by putting out whitespace (Blanks and Newlines). So for example, if you want to write at column 30, but the current "cursor column" happens to be 40, then Set_Col (30); will move the "cursor" to column 30 on the *next* line. Trying to set the line number to a value less than the current one causes a form feed, i.e. a new page is started, and then the "cursor" is moved to the given line, by putting out Newlines. Although this works with any text file, I haven't seen any useful application of it, yet. (Set_Col can be used to create columns of numbers, or the like; advancing to the next line is sensible if an entry happens to be wider than the space allowed; but I can hardly imagine what Set_Line could be good for.) I still remember my first Ada program, in which I tried to move the cursor with Text_IO. The output looked very strange... :-) So, actual cursor positioning has to be done using the previously suggested method (escape sequences to the terminal). The sequence given by Phil Brashear is correct, BTW: Put (Ascii.Esc & "[" & Line_Number_As_String & ";" & Column_Number_As_String & "H"); Note, however, that the output is (generally?) not flushed if you do this. Text_IO only flushes after a Newline (and in some other situations). If you want to see the output immediately, you also have to look out for a flush procedure -- which is not part of Text_IO, and can only be implemented "foreignly" (ioctl, for example). Some compiler vendors supply such a procedure. There also is one the IEEE Posix binding. -- Andre Spiegel | This life is a test. It is only a test. | Had this been an actual life, you would University of Stuttgart, Germany | have received further instructions as to Computer Science | where to go and what to do. -- Author unknown e-mail: spiegel@bruessel.informatik.uni-stuttgart.de