comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve Doiel" <nospam_steved@pacifier.com>
Subject: Re: ObjectAda and ANSI.SYS
Date: 1998/06/18
Date: 1998-06-18T00:00:00+00:00	[thread overview]
Message-ID: <3589c1e7.0@news.pacifier.com> (raw)
In-Reply-To: 3587B2D4.489C@ddre.dk


Hans Marqvardsen wrote in message <3587B2D4.489C@ddre.dk>...
>Hans Marqvardsen wrote:
>>
>> I am reading Feldman&Koffman:Ada95 and would like to use their SCREEN
>> package on Windows NT4.0 (and also Windows 95).
>>
>> The book says I have to install ANSI.SYS first.
>>

I spent an hour or so trying to get this to work, then found an indication
in the NT help files that ANSI.SYS and CONFIG.NT don't apply to 32 bit NT
applications.

What follows is my implementation of the Screen package body that works.  It
is not optimal but it does the job.  It also requires Win32Ada which may be
obtained from the AdaIC.  Patches are available from Pascal Obry's web page.

SteveD
=========================================================


pragma Linker_Options( "-lkernel32" );
WITH Win32;
WITH Win32.WinNt;
WITH Win32.WinBase;
WITH Win32.WinCon;
WITH Ada.Text_Io;
WITH System;
PACKAGE BODY Screen IS
------------------------------------------------------------------------
--| Body of screen-handling package
--| Author: Michael B. Feldman, The George Washington University
--| Last Modified: July 1995
--| Modified SJD, Oct 1997 - NT Version
------------------------------------------------------------------------
  PACKAGE WinBase RENAMES Win32.Winbase;
  PACKAGE WinCon RENAMES Win32.WinCon;
  PACKAGE WinNt RENAMES Win32.WinNt;
  PACKAGE Text_Io RENAMES Ada.Text_Io;

  USE type Winnt.Handle;
  USE type Win32.BOOL;

  PROCEDURE Beep IS
  BEGIN
    Text_IO.Put (Item => ASCII.BEL);
  END Beep;
  PROCEDURE ClearScreen IS
  BEGIN
    FOR ii IN 1..Screen_Depth LOOP
      MoveCursor( 1, ii );
      Text_Io.Put( String'(1..Screen_Width => ' ') );
    END LOOP;
  END ClearScreen;
  PROCEDURE MoveCursor (Column : Width; Row : Depth) IS
    handle : Winnt.Handle;
    result : Win32.BOOL;
  BEGIN
    handle := WinBase.GetStdHandle( WinBase.STD_OUTPUT_HANDLE );
    result := WinCon.SetConsoleCursorPosition(
                  handle,
                  WinCon.COORD'( X => Win32.Short( Column ),
                                 y => Win32.Short( Row ) ) );
  END MoveCursor;
END Screen;







  reply	other threads:[~1998-06-18  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-17  0:00 ObjectAda and ANSI.SYS Hans Marqvardsen
1998-06-17  0:00 ` Hans Marqvardsen
1998-06-18  0:00   ` Steve Doiel [this message]
1998-06-19  0:00     ` falis
1998-06-18  0:00   ` Jerry van Dijk
1998-06-19  0:00     ` Tom Grosman
1998-06-19  0:00       ` Tarjei Tj�stheim Jensen
1998-06-18  0:00 ` John Herro
1998-06-19  0:00   ` Kevin Radke
1998-06-19  0:00 ` ������
replies disabled

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