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,622fa0e87d54d0bb X-Google-Attributes: gid103376,public From: mfeldman@seas.gwu.edu (Michael Feldman) Subject: Re: Displaying positional text Date: 1996/07/31 Message-ID: <4tp552$mh0@felix.seas.gwu.edu>#1/1 X-Deja-AN: 171344396 references: <4taun9$3i2@hq.hq.af.mil> organization: George Washington University newsgroups: comp.lang.ada Date: 1996-07-31T00:00:00+00:00 List-Id: In article <4taun9$3i2@hq.hq.af.mil>, 1Lt Joel Rudy wrote: >Is there an Ada95 package that allows you to display text at position(x,y) >where x is the row, and y is the column (or something similar). I >remember this capability in Ada83, but have been unable to find it in >Ada95. > >Thanks. > >Joel > Here's simple version. Ada 83 had no standard way to do this, nor does Ada 95, but if you have an ANSI-compatible 24x80 screen, this will serve as a starting point. GNAT would call these screen.ad[sb]. Mike Feldman 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.Flush; Ada.Text_IO.Put (Item => ASCII.BEL); 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;