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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,79bbf7e359159d0d,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-04 20:18:06 PST Path: supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!ihnp4.ucsd.edu!newshost.nmt.edu!not-for-mail From: Jeff Shipman Newsgroups: comp.lang.ada Subject: newbie can't get exceptions to work! Date: Wed, 04 Apr 2001 21:19:18 -0600 Organization: New Mexico Institute of Mining and Technology Message-ID: <3ACBE436.4B247767@nmt.edu> NNTP-Posting-Host: grissom-48.nmt.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: newshost.nmt.edu 986440638 34410 129.138.5.218 (5 Apr 2001 03:17:18 GMT) X-Complaints-To: usenet@nmt.edu NNTP-Posting-Date: Thu, 5 Apr 2001 03:17:18 +0000 (UTC) X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.0 i686) X-Accept-Language: en Xref: supernews.google.com comp.lang.ada:6486 Date: 2001-04-04T21:19:18-06:00 List-Id: Ok, I'm creating a generic stack package and I think I've done everything properly, but I cannot seem to get my STACK_EXCEPTION to work. This is what it looks like in my gen_stack.ads file: generic LEN : NATURAL := 100; -- Size of the stack (default 100 type ELM is private; -- Used to store element type package GEN_STACK is STACK_ERROR : exception; -- Raised when something bad happens. procedure PUSH(E : in ELM); -- Push E into the stack procedure POP(E : out ELM); -- Pop element from stack; store in E function FULL return BOOLEAN; -- Returns TRUE if stack is full function EMPTY return BOOLEAN; -- Returns TRUE if stack is empty end GEN_STACK; and I can use it just fine in my gen_stack.adb. The use_gen_stack.adb file which uses the stacks works great up until the point I want to handle the exceptions. My code for handling it looks like this: -- Handle exceptions exception when STACK_ERROR => begin put_line("Error: Stack underflow/overflow"); end; When I try to compile, I get the following errors: use_gen_stack.adb:214:12: "STACK_ERROR" is not visible use_gen_stack.adb:214:12: multiple use clauses cause hiding use_gen_stack.adb:214:12: hidden declaration at gen_stack.ads:14, instance at line 32 use_gen_stack.adb:214:12: hidden declaration at gen_stack.ads:14, instance at line 31 use_gen_stack.adb:214:12: hidden declaration at gen_stack.ads:14, instance at line 30 use_gen_stack.adb:214:12: hidden declaration at gen_stack.ads:14, instance at line 29 use_gen_stack.adb:214:12: hidden declaration at gen_stack.ads:14, instance at line 28 use_gen_stack.adb:214:12: hidden declaration at gen_stack.ads:14, instance at line 27 gnatmake: "use_gen_stack.adb" compilation error make: *** [use_gen_stack] Error 4 Those relevant lines of code are: -- Convenient stack types we'll need package INT_STACK is new GEN_STACK(ELM => INTEGER, LEN => 10); package INT2_STACK is new GEN_STACK(ELM => INTEGER, LEN => 5); package FLOAT_STACK is new GEN_STACK(ELM => FLOAT, LEN => 12); package CHAR_STACK is new GEN_STACK(ELM => CHARACTER, LEN => 14); package STR_STACK is new GEN_STACK(ELM => STR, LEN => 3); package DAY_STACK is new GEN_STACK(ELM => DAY, LEN => 7); use INT_STACK; use INT2_STACK; use FLOAT_STACK; use CHAR_STACK; use STR_STACK; use DAY_STACK; At the top of my file, I have the following: with text_io; use text_io; with ada.float_text_io; use ada.float_text_io; with gen_stack; I've tried putting in use STACK_ERROR in multiple places. I just can't get this exception handler to compile. I would greatly appreciate it if someone could help me. I'm sure it's a very simple thing I'm forgetting. By the error message, it seems like it doesn't like the multiple instances of use, but If I want to use those packages I created, I have to do that! Thanks in advance, Jeff "Shippy" Shipman E-Mail: shippy@nmt.edu Computer Science Major ICQ: 1786493 New Mexico Institute of Mining and Technology Homepage: http://www.nmt.edu/~shippy