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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1e4811827f5da8f6 X-Google-Attributes: gid103376,public From: mfeldman@seas.gwu.edu (Michael Feldman) Subject: Re: Ada equiv to ncurses? Date: 1996/04/29 Message-ID: <4m371h$oec@felix.seas.gwu.edu>#1/1 X-Deja-AN: 152095144 references: <317FF9F5.2CB287FE@jinx.sckans.edu> organization: George Washington University newsgroups: comp.lang.ada Date: 1996-04-29T00:00:00+00:00 List-Id: In article <317FF9F5.2CB287FE@jinx.sckans.edu>, David Morton 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;