comp.lang.ada
 help / color / mirror / Atom feed
From: "John J. Cupak Jr." <jcj@swl.msd.ray.com>
To: Jeremy Mlazovsky <mlazovjp@flyernet.udayton.edu>
Subject: Re: Clear Screen command
Date: 1998/03/05
Date: 1998-03-05T00:00:00+00:00	[thread overview]
Message-ID: <34FEEF89.41C67EA6@swl.msd.ray.com> (raw)
In-Reply-To: 6dl8le$7b6$1@tuvoc.udayton.edu

[-- Attachment #1: Type: text/plain, Size: 988 bytes --]

Jeremy Mlazovsky wrote:
> 
> I'm sorry, I forgot to add a few details...
> 
> I am using GNAT 3.01 or whatever the most recent version is.
> 
> I'm using ADA95
> 
> I am using ADAGIDE v6.10c on Windows 95 machine with 32 megs of RAM
> 
> After posting my last message, I found a simple CLEARSCREEN procedure in a
> package included with GNAT.  I'll use that unless some one knows how to do
> it better.  Thanks
> 
> Jeremy
> 
> mlazovjp@flyernet.udayton.edu

Yup, you can use the attached Ada 95 packages and child packages.

You can figure out how to encapsulate the other screen controls
in like manner

-- 
--------------------------------------------------------------
-                 John J. Cupak Jr, CCP                      -
- Raytheon Systems Company - Software Engineering Laboratory -
- tel: 508-858-1222   email (work): jcj@swl.msd.ray.com      -
- fax: 508-858-4336   email (home): jcupak@aol.com           -
--------------------------------------------------------------

[-- Attachment #2: screen.ads --]
[-- Type: text/plain, Size: 819 bytes --]

----------------------------------------------------------------------
--  The Screen Package (Specification)
--
--  Programmer : John Cupak
--  History    :  6Oct97 jcj Created
--               17Oct97 jcj "Base" types package 
--  Description: This package defines the xterm/VT100 size
----------------------------------------------------------------------

   package Screen is
   
      Maximum_Rows    : constant := 24;
      Maximum_Columns : constant := 80;
   
      subtype Rows    is Positive range 1..Maximum_Rows;
      subtype Columns is Positive range 1..Maximum_Columns;
   
   private
   
      -- Define constant for use by all child packages
   
      -- Command Sequence Introducer (CSI)
      -- (provides screen command prefix)
   
      CSI : constant String := ASCII.ESC & "[";
   
   end Screen;

[-- Attachment #3: screen-cursor.ads --]
[-- Type: text/plain, Size: 995 bytes --]

----------------------------------------------------------------------
--  The Screen Cursor Control Child Package (Specification)
--
--  Programmer : John Cupak
--  History    : 17Oct97 jcj Created
--  Description: Moves cursor from current position
----------------------------------------------------------------------

   package Screen.Cursor is
   
      -- Move cursor "By" times - stop at top
      procedure Up   (By : in Positive := 1);
   
      -- Move cursor down "By" times - stop at bottom
      procedure Down (By : in Positive := 1);
   
      -- Move cursor right "By" times - stop at far right
      procedure Right(By : in Positive := 1);
   
      -- Move cursor left "By" times - stop at far left
      procedure Left (By : in Positive := 1);
   
      -- Set cursor position - Column=X, Row=Y
      procedure Position(Column : Columns;  
                         Row    : Rows   ); -- Line
   
      -- Set cursor home (1,1)
      procedure Home;
   
   end Screen.Cursor;

[-- Attachment #4: screen-cursor.adb --]
[-- Type: text/plain, Size: 1061 bytes --]

   with Ada.Text_IO;
   with Ada.Integer_Text_IO;

   use Ada.Text_IO;
   use Ada.Integer_Text_IO;

   package body Screen.Cursor is
   
      procedure Up   (By : in Positive := 1) is
      begin
         Put(CSI);Put(By,0);Put("A");
      end Up;
   
      procedure Down (By : in Positive := 1) is
      begin
         Put(CSI);Put(By,0);Put("B");
      end Down;
   
      procedure Right(By : in Positive := 1) is
      begin
         Put(CSI);Put(By,0);Put("C");
      end Right;
   
      procedure Left (By : in Positive := 1) is
      begin
         Put(CSI);Put(By,0);Put("D");
      end Left;
   
      procedure Position(Column : in Columns;
                         Row    : in Rows   ) is
      
      begin                                                
         Put(Item => CSI);
         Put(Item => Row,    Width => 0);
         Put(Item => ';');
         Put(Item => Column, Width => 0);
         Put(Item => 'H');
      end Position;
   
      procedure Home is
      begin
         Put(CSI & "H");
      end Home;
   
   end Screen.Cursor;

  parent reply	other threads:[~1998-03-05  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-03-04  0:00 Clear Screen command Jeremy Mlazovsky
1998-03-05  0:00 ` William D. Ghrist
1998-03-05  0:00 ` John J. Cupak Jr. [this message]
1998-03-05  0:00   ` Jerry van Dijk
1998-03-05  0:00 ` Robert Dewar
replies disabled

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