comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: hello world ada-ncurses new_window
Date: Fri, 08 Nov 2019 09:07:08 +0000
Date: 2019-11-08T09:07:08+00:00	[thread overview]
Message-ID: <lybltmenyb.fsf@pushface.org> (raw)
In-Reply-To: a1b58a33-26cb-43b4-9242-4ca809b343d3@googlegroups.com

Alain De Vos <devosalain71@gmail.com> writes:

> Exception:
> raised TERMINAL_INTERFACE.CURSES.CURSES_EXCEPTION : terminal_interface-curses.adb:117

If you compile with -g (enable debug) and run under the debugger (start
by saying "catch exception") you will find that the first exception is
actually raised at terminal_interface-curses.adb:248, in Create:

      W := Newwin (C_Int (Number_Of_Lines),
                   C_Int (Number_Of_Columns),
                   C_Int (First_Line_Position),
                   C_Int (First_Column_Position));
      if W = Null_Window then
         raise Curses_Exception;
      end if;

A couple of points:

About the library: it'd have been easier on us if you'd said

         raise Curses_Exception with "Create: unable to create window";

About your code: when you're starting off with an experiment, why bother
to catch exceptions and report them in a way that masks any attempt by
the library writer to help you solve problems? Just let the exception
happen. With any luck you'll get a stack trace that'll quickly lead you
to the immediate cause of the problem.
In your case, the exception happened at
terminal_interface-curses.adb:117, in End_Windows:

      if Endwin = Curses_Err then
         raise Curses_Exception;
      end if;

and End_Windows was called from your exception handler! doubly masking
the reason for the exception.

====

As to why you're getting this problem, I don't know at all. Perhaps you
need to initialize ncurses? -- just guessing.

  parent reply	other threads:[~2019-11-08  9:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07 22:05 hello world ada-ncurses new_window Alain De Vos
2019-11-08  6:50 ` J-P. Rosen
2019-11-08  9:07 ` Simon Wright [this message]
2019-11-08 13:19   ` Simon Wright
2019-11-09 11:25     ` Alain De Vos
2019-11-09 13:21       ` Dmitry A. Kazakov
replies disabled

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