comp.lang.ada
 help / color / mirror / Atom feed
From: Pascal MALAISE <malaise@magic.fr>
Subject: Current exception name
Date: 1999/01/30
Date: 1999-01-30T08:05:51+00:00	[thread overview]
Message-ID: <36B2BD5F.98C30EDF@magic.fr> (raw)

In Ada 83, I use the Verdix package CURRENT_EXCEPTION which has the
function EXCEPTION_NAME return STRING;

In my programs:
with CURRENT_EXCEPTION;
...
exception
  when others =>
    TEXT_IO.PUT_LINE ("Exception " & CURRENT_EXCEPTION.EXCEPTION_NAME);
    ...
end;


Now "porting" to gnat in Ada95, I'm trying to get a similar feature by
writting
my own Current_Exception package.
If I have properly understood, the standard use of Ada.Exceptions obliges
me to changes my handlers by:

exception
  when Current_Exception.Id: others =>
    Text_Io.Put_Line ("Exception " &
Current_Exception.Exception_Name(Id));
    ...
end;

I would like my code to be still compatible with Ada83 (except the
Current_Exception package).


I have found what I thing gnat-specific use of System.Compiler_Exceptions:

with Ada.Exceptions;
with System.Compiler_Exceptions;
package body Current_Exception is

  function Exception_Name return String is
  begin
    return Ada.Exceptions.Exception_Name(
             System.Compiler_Exceptions.Current_Exception);
  end Exception_Name;

end Current_Exception;


Has anyone found a standard Ada95 way to achieve that?

-- 
Pascal MALAISE
(priv) mailto:malaise@magic.fr
(prof) mailto:malaise@fr.airsysatm.thomson-csf.com




             reply	other threads:[~1999-01-30  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-30  0:00 Pascal MALAISE [this message]
1999-01-31  0:00 ` Current exception name dewar
1999-01-31  0:00   ` Simon Wright
replies disabled

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