From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c8166b3e982150b6 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.234.38 with SMTP id ub6mr8412920pbc.2.1339820946857; Fri, 15 Jun 2012 21:29:06 -0700 (PDT) MIME-Version: 1.0 Path: l9ni56031pbj.0!nntp.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 15 Jun 2012 23:29:05 -0500 Newsgroups: comp.lang.ada Subject: Re: Ada port of the osdev.org bare bones tutorial (mostly done) From: anon References: <46d2860a-d5e7-4c1a-be67-903490db0f89@googlegroups.com> <1ca9d254-a12a-4ec3-a4f9-081722fab147@googlegroups.com> User-Agent: Xnews/5.04.25 Message-ID: Date: Fri, 15 Jun 2012 23:29:06 -0500 X-Trace: sv3-WwfMbYQdK/KAwbJjtGho8XKaLYqjGYF11sFyu2Wli/ni7jvuV7x1dK9+4QjpXlOLszCL+IjwV6xDfIi!raaRO0w9S8jQMqaM/TFMahqDtjk9FOwxefNRN/wq9axi2ptA0jvoE7XbRwRl4WEXOC3jsJy0NLoi!S+QYZF/t X-Complaints-To: www.supernews.com/docs/abuse.html X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 4178 Date: 2012-06-15T23:29:06-05:00 List-Id: Try this: -- -- This pragma allows exceptions to be handled by routines or by -- the catch all Last_Chance_Hander. -- pragma Restrictions ( No_Exception_Registration ) ; -- -- These pragmas stops exceptions on many fronts. -- -- pragma Restrictions ( No_Exceptions ) ; -- pragma Restrictions ( No_Exception_Handlers ) ; -- pragma Restrictions ( No_Exception_Propagation ) ; ---------------------------------------------------------------------- -- Last_Chance_Handler: Displays a Exception Termination Message. -- -- Shutdowns run-time-system. -- -- Halts processor. -- ---------------------------------------------------------------------- ----------------------------------------------------------------- -- compile/bind/link with "--RTS=x86" for x86 Bare Bones -- -- Run-Time System. -- ----------------------------------------------------------------- with Ada.Characters.Latin_1 ; -- for ESC character -- with Ada.Text_IO ; -- Must have full exception -- working to use with System ; with System.IO ; procedure Teste is use Ada.Characters.Latin_1 ; -- use Ada.Text_IO ; use System ; use IO ; Hello_Error : exception ; begin -- -- Clear Screen and Display Title message using -- VT100 / VT52 ANSI escape sequences -- -- Works on most OSs including Linux. -- Put ( ESC & "[2J" ) ; -- clear screen Put ( ESC & "[12;30H" ) ; -- set screen location Put ( ESC & "[31;40;01m" ) ; -- set text color to Red/Black Put ( "Bare Bone: " ) ; Put ( ESC & "[37;40;00m" ) ; -- reset color Put_Line ( "Hello" ) ; New_Line ; -- -- Without a Exception handler the following will cause -- the last chance handler to be executed, directly. -- raise Hello_Error ; -- raise Program_Error ; -- Exception Handler: -- -- The first two handlers will raise another exception that -- will be handled by the Last_Chance_Handler. -- -- The third handler will not propagate the exception. -- In turn, the Last_Chance_Hander will not be executed. -- -- exception -- when Hello_Error => Put_Line ( "Exception Error: Hello" ) ; raise ; -- when Program_Error => Put_Line ( "Exception Error: Program" ) ; raise ; -- when others => Put_Line ( "Exception Error: All Others" ) ; end Teste ; Lucretia wrote in news:1ca9d254-a12a-4ec3-a4f9-081722fab147@googlegroups.com: > I've also posted a bug to GCC's bug tracker as I'm lead to believe > it's possible to declare and use your own exceptions with local > exception handling, but it's failing. > > I don't know if AdaCore people still read this, but it would be > interesting to know if it is possible or not and if it is can I get a > patch? > > Luke. >