From: daver@Starbase.NeoSoft.COM (Dave Retherford)
Subject: Re: GOTOXY in Ada ?
Date: 8 Dec 1994 22:19:38 -0600
Date: 1994-12-08T22:19:38-06:00 [thread overview]
Message-ID: <3c8lsq$rhu@Starbase.NeoSoft.COM> (raw)
In-Reply-To: 1994Dec8.080423.3368@sei.cmu.edu
In article <1994Dec8.080423.3368@sei.cmu.edu>,
Philip Brashear <brashear@ajpo.sei.cmu.edu> wrote:
> In article <3c4a9a$1lts@obelix.uni-muenster.de> ahlersj@comix.uni-muenster.de (Jan Ahlers) writes:
> >
> >Is there an equivalent in Ada to the gotoxy command in Pascal (-> put the
> >cursor at column x, row y) ? Answers would be greatly appreciated !
> >
>
> Jan, let me point out that Pascal has no such command either. The particular
> Pascal implementation (compiler/environment/libraries) that you are using is
> kind enough to supply you with cursor movement operations. You must realize
> that such things are completely dependent on the kind of display device you
> are using. Since Pascal is intended to be portable, the language definition
> doesn't specify such things.
>
> That being said, it should be obvious that Ada doesn't specify cursor control
> either. However, it's simple enough to write your own, provided that you can
> track down the appropriate "escape sequences" that make your terminal do what
> you want. Just do text_io "put" to the screen, sending a string like
>
> ASCII.ESC & "[6;14H"
>
> If you're using an ANSI standard terminal, will send the cursor to line 6,
> column 14.
>
> DISCLAIMER: I didn't try this precisely -- I depended on memory and an out-
> of-date reference manual for a particular terminal. Nevertheless, the idea
> works. I've used it several times.
>
> Good hunting!
>
> Phil Brashear
> CTA INCORPORATED
>
>
Or you could 'roll your own' version:
--------
package cursor_control is
procedure gotoxy(x : in positive_count, y : in positive_count);
end cursor_control;
with text_io;
package body cursor_control is
procedure gotoxy(x : in positive_count, y : in positive_count) is
begin
text_io.set_col(to => x);
text_io.set_line(to => y);
end gotoxy;
end cursor_control;
----------
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).
Hope this helps.
Dave.
--
_________________________________________________________________________
| Dave Retherford |"Remember this: the guy down |
| Daver@Neosoft.com or: | there kissing your butt could be |
| Dave_Retherford@hso.link.com [work] | just as easily biting it too." |
| | -- Forestt Gump |
|______________________________________|__________________________________|
next prev parent reply other threads:[~1994-12-09 4:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-12-07 12:36 GOTOXY in Ada ? Jan Ahlers
1994-12-08 13:04 ` Philip Brashear
1994-12-09 4:19 ` Dave Retherford [this message]
1994-12-12 8:45 ` Keith Thompson
1994-12-13 10:09 ` Andre Spiegel
1994-12-09 2:59 ` Michael Feldman
1994-12-09 15:22 ` Do-While Jones
1994-12-10 21:00 ` Michael Feldman
-- strict thread matches above, loose matches on Subject: below --
1994-12-20 2:06 GOTOXY IN ADA ? Michael Hagerty
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox