* hello world ada-ncurses new_window
@ 2019-11-07 22:05 Alain De Vos
2019-11-08 6:50 ` J-P. Rosen
2019-11-08 9:07 ` Simon Wright
0 siblings, 2 replies; 6+ messages in thread
From: Alain De Vos @ 2019-11-07 22:05 UTC (permalink / raw)
Creating a window in ada-ncurses raises an exception :
Code,
with Terminal_Interface.Curses;
use Terminal_Interface.Curses;
....
with Ada.Exceptions;
use Ada.Exceptions;
with GNAT.OS_Lib;
use GNAT.OS_Lib;
with Text_IO;
use Text_IO;
with Ada.Text_IO;
use Ada.Text_IO;
procedure test01 is
begin
W1 := New_Window (5,5,1,1);
Delete (W1);
exception
when Event : others =>
Terminal_Interface.Curses.End_Windows;
Text_IO.Put ("Exception: ");
Text_IO.Put (Exception_Name (Event));
Text_IO.New_Line;
GNAT.OS_Lib.OS_Exit (1);
end test01;
Exception:
raised TERMINAL_INTERFACE.CURSES.CURSES_EXCEPTION : terminal_interface-curses.adb:117
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: hello world ada-ncurses new_window
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
1 sibling, 0 replies; 6+ messages in thread
From: J-P. Rosen @ 2019-11-08 6:50 UTC (permalink / raw)
Le 07/11/2019 à 23:05, Alain De Vos a écrit :
> GNAT.OS_Lib.OS_Exit (1);
Package Ada.Command_Line has a procedure Set_Exit_Status. It's always
better to use standard subprograms, Ada is for portability after all!
--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: hello world ada-ncurses new_window
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
2019-11-08 13:19 ` Simon Wright
1 sibling, 1 reply; 6+ messages in thread
From: Simon Wright @ 2019-11-08 9:07 UTC (permalink / raw)
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: hello world ada-ncurses new_window
2019-11-08 9:07 ` Simon Wright
@ 2019-11-08 13:19 ` Simon Wright
2019-11-09 11:25 ` Alain De Vos
0 siblings, 1 reply; 6+ messages in thread
From: Simon Wright @ 2019-11-08 13:19 UTC (permalink / raw)
Simon Wright <simon@pushface.org> writes:
> About the library: it'd have been easier on us if you'd said
I meant, if the library author had said
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: hello world ada-ncurses new_window
2019-11-08 13:19 ` Simon Wright
@ 2019-11-09 11:25 ` Alain De Vos
2019-11-09 13:21 ` Dmitry A. Kazakov
0 siblings, 1 reply; 6+ messages in thread
From: Alain De Vos @ 2019-11-09 11:25 UTC (permalink / raw)
On Friday, November 8, 2019 at 2:20:00 PM UTC+1, Simon Wright wrote:
> Simon Wright <simon@pushface.org> writes:
>
> > About the library: it'd have been easier on us if you'd said
>
> I meant, if the library author had said
It seemed I just needed :
Init_Screen;
That was easy.
However , writing a program with just one input text form seems impossible for me.
Maybe I mus stick to Ada.Text_IO.Get_Line;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: hello world ada-ncurses new_window
2019-11-09 11:25 ` Alain De Vos
@ 2019-11-09 13:21 ` Dmitry A. Kazakov
0 siblings, 0 replies; 6+ messages in thread
From: Dmitry A. Kazakov @ 2019-11-09 13:21 UTC (permalink / raw)
On 2019-11-09 12:25, Alain De Vos wrote:
> On Friday, November 8, 2019 at 2:20:00 PM UTC+1, Simon Wright wrote:
>> Simon Wright <simon@pushface.org> writes:
>>
>>> About the library: it'd have been easier on us if you'd said
>>
>> I meant, if the library author had said
>
> It seemed I just needed :
> Init_Screen;
> That was easy.
>
> However , writing a program with just one input text form seems impossible for me.
>
> Maybe I mus stick to Ada.Text_IO.Get_Line;
Terminal interface curses [you]. Sorry, could not resist.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-11-09 13:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-11-08 13:19 ` Simon Wright
2019-11-09 11:25 ` Alain De Vos
2019-11-09 13:21 ` Dmitry A. Kazakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox