From: mfeldman@seas.gwu.edu (Michael Feldman)
Subject: Re: Ada equiv to ncurses?
Date: 1996/04/29
Date: 1996-04-29T00:00:00+00:00 [thread overview]
Message-ID: <4m371h$oec@felix.seas.gwu.edu> (raw)
In-Reply-To: 317FF9F5.2CB287FE@jinx.sckans.edu
In article <317FF9F5.2CB287FE@jinx.sckans.edu>,
David Morton <dmorton@jinx.sckans.edu> wrote:
>The subject says it all... Is there any Ada
>packages similar to ncurses? I don't need that
>*big* of a package, but something to tell the
>cursor to goto(X,Y) that is portable would be nice.
Here is a little package to get you started.
PACKAGE Screen IS
------------------------------------------------------------------
--| Procedures for drawing pictures on ANSI Terminal Screen
--| Author: Michael B. Feldman, The George Washington University
--| Last Modified: October 1995
------------------------------------------------------------------
ScreenHeight : CONSTANT Integer := 24;
ScreenWidth : CONSTANT Integer := 80;
SUBTYPE Height IS Integer RANGE 1..ScreenHeight;
SUBTYPE Width IS Integer RANGE 1..ScreenWidth;
TYPE Position IS RECORD
Row : Height := 1;
Column: Width := 1;
END RECORD;
PROCEDURE Beep;
-- Pre: none
-- Post: the terminal beeps once
PROCEDURE ClearScreen;
-- Pre: none
-- Post: the terminal screen is cleared
PROCEDURE MoveCursor (To: IN Position);
-- Pre: To is defined
-- Post: the terminal cursor is moved to the given position
END Screen;
WITH Ada.Text_IO;
WITH Ada.Integer_Text_IO;
PACKAGE BODY Screen IS
------------------------------------------------------------------
--| Procedures for drawing pictures on ANSI Terminal Screen
--| These procedures will work correctly only if the actual
--| terminal is ANSI compatible. ANSI.SYS on a DOS machine
--| will suffice.
--| Author: Michael B. Feldman, The George Washington University
--| Last Modified: September 1995
------------------------------------------------------------------
PROCEDURE Beep IS
BEGIN
Ada.Text_IO.Put (Item => ASCII.BEL);
Ada.Text_IO.Flush;
END Beep;
PROCEDURE ClearScreen IS
BEGIN
Ada.Text_IO.Put (Item => ASCII.ESC);
Ada.Text_IO.Put (Item => "[2J");
Ada.Text_IO.Flush;
END ClearScreen;
PROCEDURE MoveCursor (To: IN Position) IS
BEGIN
Ada.Text_IO.Flush;
Ada.Text_IO.Put (Item => ASCII.ESC);
Ada.Text_IO.Put ("[");
Ada.Integer_Text_IO.Put (Item => To.Row, Width => 1);
Ada.Text_IO.Put (Item => ';');
Ada.Integer_Text_IO.Put (Item => To.Column, Width => 1);
Ada.Text_IO.Put (Item => 'f');
END MoveCursor;
END Screen;
next prev parent reply other threads:[~1996-04-29 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-04-25 0:00 Ada equiv to ncurses? David Morton
1996-04-29 0:00 ` Michael Feldman [this message]
1996-04-29 0:00 ` Michael Feldman
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox