Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GNAT Ada - Clear Screen

666 views
Skip to first unread message

Fingertip

unread,
Apr 18, 2003, 5:05:44 AM4/18/03
to
Hello everyone,

This is the first time I post here, so I hope I don't violate any
guidelines and/or rules you guys set here.

Now, for my question:

I am using a GNAT Ada compiler, and I want to be able to clear the console
window.

I've searched the net for some solutions, but the only solutions I found
were:
ADA.TEXT_IO.NEW_PAGE;

And:
ADA.TEXT_IO.NEW_LINE (24);

The first solution doesn't really work. It just outputs the ASCII.FF char,
but it doesn't do anything.

The second solution isn't much help, because it moves the marker to the
bottom of the screen. When I try to get it back to the top with:
ADA.TEXT_IO.SET_COL (1);
ADA.TEXT_IO.SET_LINE (1);

It outputs the ASCII.FF character again, but does nothing else.

I would appreciate any help you have to offer.

Thanks in advace,
Fingertip

David C. Hoos, Sr.

unread,
Apr 18, 2003, 5:19:04 AM4/18/03
to comp.lang.ada mail to news gateway, kam...@actcom.co.il
Your problem is not an Ada (language) issue, but an OS issue.
You would have the same problem with any language.

Rather than go into all of the possibilities, if you can
tell us what OS you're using, and what Ada compiler, we'll
be able to give you more directed help.

> _______________________________________________
> comp.lang.ada mailing list
> comp.l...@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
>
>

David Holm

unread,
Apr 18, 2003, 6:01:27 AM4/18/03
to
Hi,
there is an ncurses binding for Ada. I suggest you get that if you want to be able to do
advanced console manipulations that work on all kinds of terminals.

//David Holm

Fingertip

unread,
Apr 18, 2003, 6:01:21 AM4/18/03
to
"David C. Hoos, Sr." <david.c...@ada95.com> wrote in
news:mailman.2.1050657623...@ada.eu.org:

> Your problem is not an Ada (language) issue, but an OS issue.
> You would have the same problem with any language.
>
> Rather than go into all of the possibilities, if you can
> tell us what OS you're using, and what Ada compiler, we'll
> be able to give you more directed help.


WinME.

But I want it to run on other WinX OS...

Thanks!

Fingertip

Jeffrey Creem

unread,
Apr 18, 2003, 6:55:43 AM4/18/03
to
Note that the ncurses binding is built in to the later ncurses distributions
so you dont have to go
looking for it.

ftp://ftp.gnu.org/gnu/ncurses

"Fingertip" <kam...@deletethispart.actcom.co.il> wrote in message
news:newscache$828jdh$1ko$1...@lnews.actcom.co.il...

Fingertip

unread,
Apr 18, 2003, 7:02:45 AM4/18/03
to
David Holm <da...@realityrift.com> wrote in
news:20030418120111...@realityrift.com:

> Hi,
> there is an ncurses binding for Ada. I suggest you get that if you
> want to be able to do advanced console manipulations that work on all
> kinds of terminals.
>
> //David Holm
>

As a beginner programmer in ada, can you be a bit more specific?

What is a binding? Where can I find the one you are talking about?

Thanks!

Fingertip

Fingertip

unread,
Apr 18, 2003, 10:25:14 AM4/18/03
to
Hmm... I thought GNAT Ada explained enough about the compiler. Apparently I
was wrong. So, the exact version is:

"AdaGIDE v. 6.22.10"

Thanks in advance,
Fingertip

Preben Randhol

unread,
Apr 18, 2003, 10:36:36 AM4/18/03
to
Fingertip wrote:
> Hmm... I thought GNAT Ada explained enough about the compiler. Apparently I
> was wrong. So, the exact version is:
>
> "AdaGIDE v. 6.22.10"

This is the IDE you are using, not the compiler.

Preben

Fingertip

unread,
Apr 18, 2003, 10:56:07 AM4/18/03
to
Preben Randhol <randho...@pvv.org> wrote in
news:slrnba03ar.rk...@kiuk0152.chembio.ntnu.no:

> This is the IDE you are using, not the compiler.
>
> Preben

Oh...

Erm, then maybe it is "GNATMAKE 3.12P"?

Thanks again,
Fingertip

Preben Randhol

unread,
Apr 18, 2003, 11:15:52 AM4/18/03
to
Fingertip wrote:
> Preben Randhol <randho...@pvv.org> wrote in
> news:slrnba03ar.rk...@kiuk0152.chembio.ntnu.no:
>
>> This is the IDE you are using, not the compiler.
>>
>> Preben
>
> Oh...
>
> Erm, then maybe it is "GNATMAKE 3.12P"?

Yes sound correct. I recommend you upgrade to Gnat 3.15p as Gnat 3.12p
is very old.

You can find it here: http://libre.act-europe.fr/GNAT/

Preben

tmo...@acm.org

unread,
Apr 18, 2003, 12:47:18 PM4/18/03
to
> WinME.
If that will support ANSI.SYS in text mode, go to www.adaic.com
and search for "ansi terminal emulator"

> But I want it to run on other WinX OS...

I note "ansi.sys" is present in my w2k's winnt\system32 directory, but
I haven't actually tried it. Windows really prefers that you use their
GUI rather than text mode.

Michael Bode

unread,
Apr 18, 2003, 1:54:28 PM4/18/03
to
tmo...@acm.org writes:

> I note "ansi.sys" is present in my w2k's winnt\system32 directory, but
> I haven't actually tried it. Windows really prefers that you use their
> GUI rather than text mode.

This is only for DOS apps. It is not used for Windows apps. You need a
DOS Ada compiler to use ANSI escape codes with NT. The proper
functions for Windows apps are the Windows console API. Specifically
to clear the console screen in Windows use this method:
http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b99261

--
Für OE User: http://learn.to/quote/
OE users please read http://www.uwasa.fi/~ts/http/quote.html
PGP Key: http://home.t-online.de/home/michael_bode/
Legal Disclaimer: Wer Sarkasmus findet, darf ihn behalten.

Richard Riehle

unread,
Apr 18, 2003, 3:06:03 PM4/18/03
to
Fingertip wrote:

> I am using a GNAT Ada compiler, and I want to be able to clear the console
> window.

Dowload a copy of NT_Console or Console_IO, both of which will be
more fund to use than Ada.Text_IO on a Windows platform. These
are written by Jerry Van Dijk. I think both are available from either
of the Ada web sites.

Richard Riehle

David Holm

unread,
Apr 18, 2003, 9:05:35 PM4/18/03
to

Steve

unread,
Apr 18, 2003, 11:40:27 PM4/18/03
to
"Fingertip" <kam...@deletethispart.actcom.co.il> wrote in message
news:newscache$ahdjdh$dso$1...@lnews.actcom.co.il...

Some things you would like to program which are not "built in" to the
programming language (like clearing the screen). To perform these
operations you must call routines that are not built into the language, and
are operating system specific.

"Bindings" refer to the code that permit you to access libraries from Ada.

A good source of bindings and general information is found at:
http://www.adapower.com

You'll also find a lot of links to other good sites there.

For clearing the screen go to:

http://users.ncrvnet.nl/gmvdijk/packages.html

And take a look at the NT/Win95 Console package.

I think it has what you're looking for.

Steve
(The Duck)

> Thanks!
>
> Fingertip


Tarjei T. Jensen

unread,
Apr 19, 2003, 2:43:07 AM4/19/03
to

"Fingertip" wrote:
> I am using a GNAT Ada compiler, and I want to be able to clear the console
> window.

There is a solution. You will have to search this newsgroup. Search this
group for the name "Jerry van Dijk". He has created a NT console package.

BTW I have not used it.

greetings,

Aurele Vitali

unread,
Apr 19, 2003, 12:25:00 PM4/19/03
to
"Tarjei T. Jensen" <tar...@online.no> wrote in message news:<9e6oa.5034$8g5....@news2.e.nsc.no>...

Here a quick way of clearing the screen on NT:

function Command_Interpreter( Command : in Interfaces.C.Strings.Chars_Ptr )
return Interfaces.C.Int;
pragma import( c, Command_Interpreter, "system" );

-- Set_Console_Mode: This function sets the number of lines and columns

procedure Set_Console_Mode is
iResult : Interfaces.C.Int;
begin
iResult := Command_Interpreter( Interfaces.C.Strings.New_String(
"MODE CON COLS=80 LINES=25" ) );
end Set_Console_Mode;

-- Clear_Screen: This function clears the screen

procedure Clear_Screen is
iResult : Interfaces.C.Int;
begin
iResult := Command_Interpreter( Interfaces.C.Strings.New_String( "CLS" ) );
end Clear_Screen;

Cheers
Aurele

0 new messages