comp.lang.ada
 help / color / mirror / Atom feed
* Weird Exception Problem
@ 1992-09-18  1:38 dog.ee.lbl.gov!hellgate.utah.edu!cascades.utah.edu!matwood
  0 siblings, 0 replies; 3+ messages in thread
From: dog.ee.lbl.gov!hellgate.utah.edu!cascades.utah.edu!matwood @ 1992-09-18  1:38 UTC (permalink / raw)


I am still learning Ada (the hard way) and have encountered a weird problem.
I don't know if its a compiler problem or if It's Supposed To Do That".

We have a moderatly large (14 KLOC) Ada program on an HP controller
(pretty much a HP9000/300 type thing) and we're using Alsys Ada 5.5.0.
I seems to be impossible to talk to a real live non-saleperson there.
We're controlling a piece of equipment via an HPIB IEEE-488 bus.  If
the equipment or the HPIB cable goes down, we have set it up to raise
a TEXT_IO.DEVICE_ERROR.  This works great, most of the time.

In one package, if an exception is raised, we get a PROGRAM_ERROR with
no hints.  No stack trace, no exec history, no line numbers, no reason
given, and whats worse -- we cannot trap it in a handler.  I've
intentintionally caused exceptions in this part of the code, and got
the same behavior.  This code isnt any different in any way that I
can tell from other parts of this program, where the exception
handling works great.

I tried reading the LRM and it doesnt help much.  It says that a
PROGRAM_ERROR can be raised if I try using something before its been
"elaborated".  I guess its a good yardstick of the depth of my Ada
understanding that I still dont know what "elaboration" really is, even
after reading the LRM.

Also, if an exception is raised in a "library unit" the program will
abort.  Once again, I couldn't figure out what a "library unit" is.

All this stuff seems to be in LRM section 10.


Can anyone help me out?


---
Mark Atwood               :: DOD-STD-2167A and DOD-STD-1815A
matwood@peruvian.utah.edu :: All who understand, I smile with you.
The University has enough problems without being blamed for mine.

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

* Re: Weird Exception Problem
@ 1992-09-18  9:16 Leif Euren
  0 siblings, 0 replies; 3+ messages in thread
From: Leif Euren @ 1992-09-18  9:16 UTC (permalink / raw)


Mark Atwood <matwood%cascades.utah.edu@cs.utah.edu> writes:

>In one package, if an exception is raised, we get a PROGRAM_ERROR ...

>I tried reading the LRM and it doesnt help much.  It says that a
>PROGRAM_ERROR can be raised if I try using something before its been
>"elaborated".  I guess its a good yardstick of the depth of my Ada
>understanding that I still dont know what "elaboration" really is, even
>after reading the LRM.

My best description of the elaboration is to say "it a kind of
execution of the declarations".  The declarations of the various Ada
units are traversed, and among other things constants and initiated
variables get their values.  As thay can get values from a function
call, the body of that function has to be elaborated and executed
before the elaboration of that particular declaration can finish.

But as described in LRM 10.5, this may not always be the case when
trusting the automatic elaboration scheme. Thus the predefined pragma
ELABORATE.

Now, your exception may be caused by a number (next to infinite :-) of
things.  My suggestion is that you try to force elaboration on all
units your package depends on.  If that doesn't help, well then I
don't know.

	Good luck!  /Leif Euren
 __  __ 
|  \   |  All opinions are my own, even if my employer claims otherwise!
|   \  |
|      |	Leif Euren			NobelTech Systems AB
|  \   |	System Manager Rational  	S-175 88 JARFALLA
|__ \__|	tel: +46-758-84072		Sweden

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

* Re: Weird Exception Problem
@ 1992-09-18 17:05 Bob Kitzberger
  0 siblings, 0 replies; 3+ messages in thread
From: Bob Kitzberger @ 1992-09-18 17:05 UTC (permalink / raw)


matwood%cascades.utah.edu@cs.utah.edu (Mark Atwood) writes:

>Also, if an exception is raised in a "library unit" the program will
>abort.  Once again, I couldn't figure out what a "library unit" is.

Library units are similar to C's 'file scope'.  If you declare a unit
(package, subprogram, etc.) and it is NOT nested within another 
unit. then it is a library unit.

e.g. the following file:

	  package library_unit is
	    procedure not_library_unit;
	    package also_not_library_unit is
	      procedure very_much_not_library_unit;
	    end...
	  end library_unit;

	  procedure library_unit_too;

Personally, I try to only have packages as library units.  Declaring
subprograms at the 'library unit' level pollutes the namespace.

	.Bob.
----------------
Bob Kitzberger          VisiCom Laboratories, Inc.
rlk@visicom.com         10052 Mesa Ridge Court, San Diego CA 92121 USA
                        +1 619 457 2111    FAX +1 619 457 0888

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

end of thread, other threads:[~1992-09-18 17:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-09-18  1:38 Weird Exception Problem dog.ee.lbl.gov!hellgate.utah.edu!cascades.utah.edu!matwood
  -- strict thread matches above, loose matches on Subject: below --
1992-09-18  9:16 Leif Euren
1992-09-18 17:05 Bob Kitzberger

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