comp.lang.ada
 help / color / mirror / Atom feed
* Clear screen command?
@ 1998-03-04  0:00 Jeremy Mlazovsky
  1998-03-05  0:00 ` Tarjei Tj�stheim Jensen
  1998-03-05  0:00 ` Juergen Pfeifer
  0 siblings, 2 replies; 5+ messages in thread
From: Jeremy Mlazovsky @ 1998-03-04  0:00 UTC (permalink / raw)



Right now, I am stuck doing the generic ADA output that pushes the screen up
one line at a time as another line of text is output.

I need to know how to clear the screen after a certain number of lines have
been output to the screen.

Is there some way to make it so that the screen is "locked" in one position,
so that text at the top of the screen remains at the top, and subsequent
lines of output go to the bottom of the screen?

Thanks in advance

Jeremy

mlazovjp@flyernet.udayton.edu






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Clear screen command?
  1998-03-04  0:00 Clear screen command? Jeremy Mlazovsky
@ 1998-03-05  0:00 ` Tarjei Tj�stheim Jensen
  1998-03-05  0:00   ` Markus Kuhn
  1998-03-05  0:00 ` Juergen Pfeifer
  1 sibling, 1 reply; 5+ messages in thread
From: Tarjei Tj�stheim Jensen @ 1998-03-05  0:00 UTC (permalink / raw)



Jeremy Mlazovsky wrote:
> 
> Right now, I am stuck doing the generic ADA output that pushes the screen up
> one line at a time as another line of text is output.
> 
> I need to know how to clear the screen after a certain number of lines have
> been output to the screen.
> 
> Is there some way to make it so that the screen is "locked" in one position,
> so that text at the top of the screen remains at the top, and subsequent
> lines of output go to the bottom of the screen?
> 

This is all completely dependent on the terminal used to view the result. If you
want this to  work on a DEC compatible terminal, you are lucky, but you will
have to read up on the escape sequences that will make the terminal behave like
you want.

Your luck with other terminals (ansi.sys, etc) may vary.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Clear screen command?
  1998-03-05  0:00 ` Tarjei Tj�stheim Jensen
@ 1998-03-05  0:00   ` Markus Kuhn
  1998-03-06  0:00     ` Nick Roberts
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Kuhn @ 1998-03-05  0:00 UTC (permalink / raw)



To clear a screen on any ISO 6429 compatible terminal (that's
everything claiming to be VT100 or ANSI or xterm compatible),
just use procedures such as

-- warning: the following code is untested

with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;

procedure Clear_Screen is
begin
  put(ESC & "[2J");
end;

procedure Goto_XY(Row, Column: Natural) is
begin
  put(ESC & "[");
  put(Row);
  put(';');
  put(Column);
  put('H');
end;

For all the VT100/ISO 6429 commands, see for instance 

  http://www.fh-jena.de/~gmueller/Kurs_halle/esc_vt100.html

Completing the above into a nice ISO6429 package for controlling
text terminals is left as a small exercise to the reader.

Hope this helped ...

Markus

-- 
Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
email: mkuhn at acm.org,  home page: <http://www.cl.cam.ac.uk/~mgk25/>




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Clear screen command?
  1998-03-04  0:00 Clear screen command? Jeremy Mlazovsky
  1998-03-05  0:00 ` Tarjei Tj�stheim Jensen
@ 1998-03-05  0:00 ` Juergen Pfeifer
  1 sibling, 0 replies; 5+ messages in thread
From: Juergen Pfeifer @ 1998-03-05  0:00 UTC (permalink / raw)



Jeremy Mlazovsky wrote:
> 
> Right now, I am stuck doing the generic ADA output that pushes the screen up
> one line at a time as another line of text is output.
> 
> I need to know how to clear the screen after a certain number of lines have
> been output to the screen.
> 
> Is there some way to make it so that the screen is "locked" in one position,
> so that text at the top of the screen remains at the top, and subsequent
> lines of output go to the bottom of the screen?
> 
You can solve your problem by using the curses library provided with almost
any UNIX like system. The curses library is a set of C routines allowing to
program your screen in a terminal independent way. If you think this is the
right way to go you may pick up the just released free software implementation
of curses named "ncurses" from ftp://prep.ai.mit.edu/pub/gnu. The nice thing
with ncurses is, that it comes with a complete Ada95 binding tested and
developed for GNAT.

Juergen




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Clear screen command?
  1998-03-05  0:00   ` Markus Kuhn
@ 1998-03-06  0:00     ` Nick Roberts
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Roberts @ 1998-03-06  0:00 UTC (permalink / raw)



Markus Kuhn wrote in message <34FE8F35.1DD7ECFD@cl.cam.ac.uk>...
[...]
|procedure Goto_XY(Row, Column: Natural) is
|begin
|  put(ESC & "[");
|  put(Row);
|  put(';');
|  put(Column);
|  put('H');
|end;

[...]

Spot the deliferate mistale! I suspect that

   procedure Goto_XY (Column, Row: in Natural)

would probably be a tad less confusing, although, frankly, I would prefer

   procedure Move_Cursor (Row, Column: in Positive)

even if it is a little less Pascalian (but I DO NOT want to start another
endless thread on naming conventions :-)

You also need

   with Ada.Text_IO, Ada.Integer_Text_IO;
   use Ada.Text_IO, Ada.Integer_Text_IO;

up front.

I seem to recall some terminals having a code to disable automatic scrolling
(making the cursor simply 'wrap-around' to the top of the screen), but I'm
not sure if this is standard. If you're interested: this facility was to
solve the problem that (in scrolling mode) it is impossible to display a
character in the extreme bottom right-hand corner. It probably seemed
important then. It's funny, in these days of near-ubiquitous WIMPiness, such
problems seem very old now.

** Nick Roberts, Croydon, UK
** Nick.Roberts@dial.pipex.com
** Voicemail & Fax +44 181-405 1124
** Proprietor, ThoughtWing Software
** Independent Software Development Consultant







^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1998-03-06  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-03-04  0:00 Clear screen command? Jeremy Mlazovsky
1998-03-05  0:00 ` Tarjei Tj�stheim Jensen
1998-03-05  0:00   ` Markus Kuhn
1998-03-06  0:00     ` Nick Roberts
1998-03-05  0:00 ` Juergen Pfeifer

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