TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Proportional Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Tucker Taft <[log in to unmask]>
Reply To:
Date:
Mon, 10 May 1999 15:03:13 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (45 lines)
Daniel Wengelin wrote:
>
> Please, could anyone see the probably obvious
> reason why this should terminate with Program_Error.
> It's basically "from the book" but I got some odd results.
> It compiles without any warnings, see below...

I added a couple of print outs to the end of your program (see "+"
lines below), and then compiled and ran it without problems (using our
AdaMagic with-C-as-intermediate compiler).  The output
looked like this:

    A_Car = (pelle,abc123)
    Another_Car = (putte,gef789)

which seems correct.

Have you tried running it with a debugger?  Presumably
that would tell you where the Program_Error is raised.

> ...
> with Ada.Strings.Unbounded;use Ada.Strings.Unbounded;
> with E1.Car;
+ with Ada.Text_IO;
> procedure E1.Main is
>    A_Car, Another_Car : E1.Car.Object;
> begin
>    A_Car := (To_Unbounded_String("putte"),
>              To_Unbounded_String("abc123"));
>    Another_Car := (To_Unbounded_String("pelle"),
>                    To_Unbounded_String("gef789"));
>    E1.CAR.Swap (A_Car ,Another_Car);
+    Ada.Text_IO.Put_Line("A_Car = (" &
+         To_String(A_Car.Name) & ',' &
+           To_String(A_Car.Registration) & ')');
+    Ada.Text_IO.Put_Line("Another_Car = (" &
+         To_String(Another_Car.Name) & ',' &
+           To_String(Another_Car.Registration) & ')');
> end E1.Main;

--
-Tucker Taft   [log in to unmask]   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA

ATOM RSS1 RSS2