# HG changeset patch # User jwe # Date 1137180343 0 # Node ID f2c058edda4064f47b854d51d335efc9b2875e52 # Parent edaf21425386fe3c086f82df0d7cd41ad466fe2b [project @ 2006-01-13 19:25:43 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2006-01-13 John W. Eaton + + * help.cc (display_help_text): Use warning() to print raw Texinfo + source. Don't redirect error output for makeinfo process. + + * DLD-FUNCTIONS/__gnuplot_raw__.l (F__gnuplot_init__): Delete + function and PKG_ADD directive. + (gnuplot::gnuplot): Call do_init here. + (gnuplot::init): Delete static function. + (gnuplot::close_all): New static function. + (class gnuplot_X): New class. + (gnpulot_X::X): New static instance. + 2006-01-12 David Bateman * help.cc (make_name_list): Add autoload functions to list of diff --git a/src/DLD-FUNCTIONS/__gnuplot_raw__.l b/src/DLD-FUNCTIONS/__gnuplot_raw__.l --- a/src/DLD-FUNCTIONS/__gnuplot_raw__.l +++ b/src/DLD-FUNCTIONS/__gnuplot_raw__.l @@ -32,8 +32,6 @@ // PKG_ADD: mark_as_command ("__gnuplot_show__"); -// PKG_ADD: __gnuplot_init__ (); - // PKG_ADD: atexit ("closeplot"); #ifdef HAVE_CONFIG_H @@ -696,7 +694,7 @@ use_title_option (Vgnuplot_use_title_option), gnuplot_exe (Vgnuplot_binary), gnuplot_terminal_type (), plot_stream () - { } + { do_init (); } public: @@ -712,13 +710,9 @@ static void close (void); - static bool plot_stream_event_handler (pid_t pid, int status); + static void close_all (void); - static void init (void) - { - if (ensure_instance ()) - instance->do_init (); - } + static bool plot_stream_event_handler (pid_t pid, int status); static void send (const std::string& cmd) { @@ -895,6 +889,19 @@ } } +void +gnuplot::close_all (void) +{ + for (std::map::const_iterator p = instance_map.begin (); + p != instance_map.end (); + p++) + { + gnuplot *elt = p->second; + + elt->do_close (); + } +} + pid_t gnuplot::pid (void) const { @@ -1454,6 +1461,19 @@ return retstr; } +// The static instance of this class is here so that +// gnuplot::close_all will be called when the .oct file is unloaded. + +class +gnuplot_X +{ +public: + gnuplot_X (void) { } + ~gnuplot_X (void) { gnuplot::close_all (); } +}; + +static gnuplot_X X; + static int automatic_replot (void) { @@ -1662,16 +1682,6 @@ // User-callable functions // ----------------------- -DEFUN_DLD (__gnuplot_init__, , , - "-*- texinfo -*-\n\ -@deftypefn {Loadable Function} __gnuplot_init__ ()\n\ -@end deftypefn") -{ - gnuplot::init (); - - return octave_value_list (); -} - DEFUN_DLD (clearplot, , , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} clearplot\n\ diff --git a/src/help.cc b/src/help.cc --- a/src/help.cc +++ b/src/help.cc @@ -661,6 +661,8 @@ if (looks_like_texinfo (msg, pos)) { + os.flush (); + std::string tmp_file_name = file_ops::tempnam ("", ""); int cols = command_editor::terminal_cols (); @@ -687,9 +689,6 @@ << " --no-headers" << " --force" << " --output \"" << tmp_file_name << "\"" -#if !defined (__MINGW32__) - << " > /dev/null 2>&1" -#endif << OSSTREAM_ENDS; oprocstream filter (OSSTREAM_STR (buf)); @@ -722,8 +721,7 @@ { warning ("help: Texinfo formatting filter exited abnormally"); warning ("help: raw Texinfo source of help text follows..."); - - os << "\n" << msg; + warning ("help:\n\n%s\n\n", msg.c_str ()); } file_ops::unlink (tmp_file_name);