octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch to Octave shutdown procedures


From: John Swensen
Subject: Re: Patch to Octave shutdown procedures
Date: Tue, 19 May 2009 23:58:54 -0400


On May 19, 2009, at 3:56 PM, Jaroslav Hajek wrote:

On Tue, May 19, 2009 at 9:36 PM, John Swensen <address@hidden> wrote:

On May 19, 2009, at 3:21 PM, Jaroslav Hajek wrote:

But why don't you call octave_main with embedded = true and just call
main_loop afterwards?

octave_main (argc, argv, true);

// possibly call install_signal_handlers () and adjust the handlers

main_loop ();

// cleanup
do_octave_atexit ();
sysdep_cleanup ();

what's the problem with this scheme?



I think there are 2 problem with this approach:
1) That still doesn't solve the problem of the Octave quit function and the signal handlers calling exit(). I suppose I could replace all the Octave signal handlers with my own, but that seems like just asking for trouble and
would still have the problem with the Octave quit function.

I think your approach solves the problem with signal handlers neither.
quit() is a real trouble.
Maybe it'd be best if there was an octave_exit function pointer, that
could be replaced?
In all places where we call exit() now, we'd just just call (*octave_exit)().


The patch I submitted does solve the problem with the Octave quit function by bypassing the call to exit(). However, I do like the idea of creating an octave_exit() function that could be replaced. I will work on a patch along these lines.

2) How do you force octave_parse () to return something other than zero to make it exit the main_loop function? I tried looking through parse.cc, but can't understand exactly what is going on in the octave_parse function (#defined as the yyparse function) and what exact condition will cause it to
return a non-zero value.


how do you supply input to Octave? just writing EOF to the stream
where Octave reads its input from should suffice.
manually setting parser_end_of_input may also work, but I wouldn't recommend it.

I verified this works for OSX and Linux, but in Windows if I send an EOF (0x04) to the terminal does it do the same thing?

--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]