comp.lang.ada
 help / color / mirror / Atom feed
* help with Ada95
@ 2003-06-18  3:47 Cephus�
  2003-06-18  5:27 ` Fionn mac Cuimhaill
  2003-06-18 17:51 ` Jeffrey Carter
  0 siblings, 2 replies; 6+ messages in thread
From: Cephus� @ 2003-06-18  3:47 UTC (permalink / raw)


Hey guys I have this book: Ada 95 3rd edition (gold (maybe yellow in color)
Problem Solving and Program Design by Feldman and Koffman.

They provide all of their code from the book examples and I am trying to use
a package of theirs dealing with the screen... here is the package spec and
body. Please tell me what is wrong with it...

Screen.ads:
-- constants; the number of rows and columns on the terminal

ScreenDepth : CONSTANT Integer := 24;

ScreenWidth : CONSTANT Integer := 80;

-- subtypes giving the ranges of acceptable inputs

-- to the cursor-positioning operation

SUBTYPE Depth IS Integer RANGE 1..ScreenDepth;

SUBTYPE Width IS Integer RANGE 1..ScreenWidth;

PROCEDURE Beep;

-- Pre: None

-- Post: Terminal makes its beep sound once

PROCEDURE ClearScreen;

-- Pre: None

-- Post: Terminal Screen is cleared

PROCEDURE MoveCursor (Column : Width; Row : Depth);

-- Pre: Column and Row have been assigned values

-- Post: Cursor is moved to the given spot on the screen

END Screen;

----------------------------------------------------------------------------
-----------------

Screen.adb

PROCEDURE Beep IS

BEGIN

Ada.Text_IO.Put (Item => Ada.Characters.Latin_1.BEL);

Ada.Text_IO.Flush;

END Beep;

PROCEDURE ClearScreen IS

BEGIN

-- Ada.Text_IO.Put (Item => Ada.Characters.Latin_1.ESC);

-- Ada.Text_IO.Put (Item => "[2J");

-- Ada.Text_IO.Flush;

Ada.TEXT_IO.New_Line(Spacing => 35);

MoveCursor(Row => 1, Column => 1);

END ClearScreen;

PROCEDURE MoveCursor (Column : Width; Row : Depth) IS

BEGIN

Ada.Text_IO.Flush;

Ada.Text_IO.Put (Item => Ada.Characters.Latin_1.ESC);

Ada.Text_IO.Put ("[");

Ada.Integer_Text_IO.Put (Item => Row, Width => 1);

Ada.Text_IO.Put (Item => ';');

Ada.Integer_Text_IO.Put (Item => Column, Width => 1);

Ada.Text_IO.Put (Item => 'f');

END MoveCursor;

END Screen;



sorry for the text, I just copied it straight from the compiler



Beau





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: help with Ada95
  2003-06-18  3:47 help with Ada95 Cephus�
@ 2003-06-18  5:27 ` Fionn mac Cuimhaill
  2003-06-18 16:41   ` Frank Piron
  2003-06-18 17:51 ` Jeffrey Carter
  1 sibling, 1 reply; 6+ messages in thread
From: Fionn mac Cuimhaill @ 2003-06-18  5:27 UTC (permalink / raw)


On Tue, 17 Jun 2003 22:47:45 -0500, "Cephus�" <beau@hiwaay.net> wrote:

>Hey guys I have this book: Ada 95 3rd edition (gold (maybe yellow in color)
>Problem Solving and Program Design by Feldman and Koffman.
>
>They provide all of their code from the book examples and I am trying to use
>a package of theirs dealing with the screen... here is the package spec and
>body. Please tell me what is wrong with it...
>
>Screen.ads:
>-- constants; the number of rows and columns on the terminal

... snip ...

>
>Ada.Text_IO.Put (Item => 'f');
>
>END MoveCursor;
>
>END Screen;
>
>
>
>sorry for the text, I just copied it straight from the compiler
>
>
This kind of question keeps coming up, is there no FAQ for this ng?

The basic assumption behind the design of the package body is that
output is going to an ANSI-compliant dumb terminal. If you compile
this code on current versions of Windows (2000, XP) you get screwy
results when you use it because the Windows console is not
ANSI-compliant. You need a completely different package body, one
which uses the Windows console API, in order to implement the spec on
Windows.

I presume that you are using Windows; otherwise, you probably wouldn't
be asking the question.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: help with Ada95
  2003-06-18  5:27 ` Fionn mac Cuimhaill
@ 2003-06-18 16:41   ` Frank Piron
  2003-06-18 16:48     ` Frank Piron
  2003-06-18 22:24     ` Jerry van Dijk
  0 siblings, 2 replies; 6+ messages in thread
From: Frank Piron @ 2003-06-18 16:41 UTC (permalink / raw)


Fionn mac Cuimhaill schrieb:

> The basic assumption behind the design of the package body is that
> output is going to an ANSI-compliant dumb terminal. If you compile
> this code on current versions of Windows (2000, XP) you get screwy
> results when you use it because the Windows console is not
> ANSI-compliant. You need a completely different package body, one
> which uses the Windows console API, in order to implement the spec on
> Windows.
> 
> I presume that you are using Windows; otherwise, you probably wouldn't
> be asking the question.

Jerry van Dijk wrote a nice Package for console-handling with
win32. Unfortunately i do not know where to download it.
Below there is Jerrys contact info from the .ads
-----------------------------------------------------------------------
--
--  File:        nt_console.ads
--  Description: Win95/NT console support
--  Rev:         0.2
--  Date:        08-june-1999
--  Author:      Jerry van Dijk
--  Mail:        jdijk@acm.org
--
--  Copyright (c) Jerry van Dijk, 1997, 1998, 1999
--  Billie Holidaystraat 28
--  2324 LK  LEIDEN
--  THE NETHERLANDS
--  tel int + 31 71 531 43 65
--
--  Permission granted to use for any purpose, provided this copyright
--  remains attached and unmodified.
--
--  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
--  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
--  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
--
-----------------------------------------------------------------------

Bye, Frank



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: help with Ada95
  2003-06-18 16:41   ` Frank Piron
@ 2003-06-18 16:48     ` Frank Piron
  2003-06-18 22:24     ` Jerry van Dijk
  1 sibling, 0 replies; 6+ messages in thread
From: Frank Piron @ 2003-06-18 16:48 UTC (permalink / raw)




Frank Piron schrieb:
> 
> Fionn mac Cuimhaill schrieb:
> 
> > The basic assumption behind the design of the package body is that
> > output is going to an ANSI-compliant dumb terminal. If you compile
> > this code on current versions of Windows (2000, XP) you get screwy
> > results when you use it because the Windows console is not
> > ANSI-compliant. You need a completely different package body, one
> > which uses the Windows console API, in order to implement the spec on
> > Windows.
> >
> > I presume that you are using Windows; otherwise, you probably wouldn't
> > be asking the question.
> 
> Jerry van Dijk wrote a nice Package for console-handling with
> win32. Unfortunately i do not know where to download it.

Finally i found one url:

http://www.eelab.usyd.edu.au/takeme/Adaexamples/Gnat-3.13/

Frank



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: help with Ada95
  2003-06-18  3:47 help with Ada95 Cephus�
  2003-06-18  5:27 ` Fionn mac Cuimhaill
@ 2003-06-18 17:51 ` Jeffrey Carter
  1 sibling, 0 replies; 6+ messages in thread
From: Jeffrey Carter @ 2003-06-18 17:51 UTC (permalink / raw)


Cephus� wrote:
> Hey guys I have this book: Ada 95 3rd edition (gold (maybe yellow in color)
> Problem Solving and Program Design by Feldman and Koffman.
> 
> They provide all of their code from the book examples and I am trying to use
> a package of theirs dealing with the screen... here is the package spec and
> body. Please tell me what is wrong with it...
> 
> Screen.ads:
> -- constants; the number of rows and columns on the terminal

"package Screen is" appears to be missing.

> 
> ScreenDepth : CONSTANT Integer := 24;
> 
> ScreenWidth : CONSTANT Integer := 80;
> 
> -- subtypes giving the ranges of acceptable inputs
> 
> -- to the cursor-positioning operation
> 
> SUBTYPE Depth IS Integer RANGE 1..ScreenDepth;
> 
> SUBTYPE Width IS Integer RANGE 1..ScreenWidth;
> 
> PROCEDURE Beep;
> 
> -- Pre: None
> 
> -- Post: Terminal makes its beep sound once
> 
> PROCEDURE ClearScreen;
> 
> -- Pre: None
> 
> -- Post: Terminal Screen is cleared
> 
> PROCEDURE MoveCursor (Column : Width; Row : Depth);
> 
> -- Pre: Column and Row have been assigned values
> 
> -- Post: Cursor is moved to the given spot on the screen
> 
> END Screen;
> 
> ----------------------------------------------------------------------------
> -----------------
> 
> Screen.adb

"package body Screen is" appears to be missing.

> 
> PROCEDURE Beep IS
> 
> BEGIN
> 
> Ada.Text_IO.Put (Item => Ada.Characters.Latin_1.BEL);
> 
> Ada.Text_IO.Flush;
> 
> END Beep;
> 
> PROCEDURE ClearScreen IS
> 
> BEGIN
> 
> -- Ada.Text_IO.Put (Item => Ada.Characters.Latin_1.ESC);
> 
> -- Ada.Text_IO.Put (Item => "[2J");
> 
> -- Ada.Text_IO.Flush;
> 
> Ada.TEXT_IO.New_Line(Spacing => 35);
> 
> MoveCursor(Row => 1, Column => 1);
> 
> END ClearScreen;
> 
> PROCEDURE MoveCursor (Column : Width; Row : Depth) IS
> 
> BEGIN
> 
> Ada.Text_IO.Flush;
> 
> Ada.Text_IO.Put (Item => Ada.Characters.Latin_1.ESC);
> 
> Ada.Text_IO.Put ("[");
> 
> Ada.Integer_Text_IO.Put (Item => Row, Width => 1);
> 
> Ada.Text_IO.Put (Item => ';');
> 
> Ada.Integer_Text_IO.Put (Item => Column, Width => 1);
> 
> Ada.Text_IO.Put (Item => 'f');
> 
> END MoveCursor;
> 
> END Screen;

Other than those problems marked, which might be cut and paste errors 
rather than errors in the code, there does not appear to be anything 
wrong with it.

It would help if you told us what error messages you were getting, or 
what makes you think there is something wrong with it. It also helps if 
you tell us what compiler and version you're using, and on what OS and 
version.

-- 
Jeff Carter
"You tiny-brained wipers of other people's bottoms!"
Monty Python & the Holy Grail




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: help with Ada95
  2003-06-18 16:41   ` Frank Piron
  2003-06-18 16:48     ` Frank Piron
@ 2003-06-18 22:24     ` Jerry van Dijk
  1 sibling, 0 replies; 6+ messages in thread
From: Jerry van Dijk @ 2003-06-18 22:24 UTC (permalink / raw)


Frank Piron <frank.piron@konad.de> writes:

> Jerry van Dijk wrote a nice Package for console-handling with
> win32. Unfortunately i do not know where to download it.

See my homepage.

-- 
--  Jerry van Dijk   | email: jvandyk@attglobal.net
--  Leiden, Holland  | web:   users.ncrvnet.nl/gmvdijk



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-06-18 22:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-18  3:47 help with Ada95 Cephus�
2003-06-18  5:27 ` Fionn mac Cuimhaill
2003-06-18 16:41   ` Frank Piron
2003-06-18 16:48     ` Frank Piron
2003-06-18 22:24     ` Jerry van Dijk
2003-06-18 17:51 ` Jeffrey Carter

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