diff libinterp/corefcn/event-manager.h @ 29254:11343ca3c125

allow Octave to operate as a server, executing commands from a queue * event-manager.h (interpreter_events::interpreter_output): New virtual fucntion. (event_manager::interpreter_output): New function. * interpreter.cc (interpeter::m_parser, interpeter::m_exit_status, interpeter::m_server_mode): New data members. (interpreter::parse_and_execute, interpreter::server_loop, (interpreter::parse_and_execute): New functions. (interpreter::execute): If server option is set, execute server_loop instead of main_loop. * pager.cc (output_system::sync): Also bypass pager if running in server mode. (output_system::do_sync): Send output to event manager if running in server mode and bypass_pager is true. * options-usage.h, octave.h, octave.cc, main.in.cc: Handle new --server option.
author John W. Eaton <jwe@octave.org>
date Thu, 17 Dec 2020 20:18:51 -0500
parents 665c9ed14c97
children 0280fd549502
line wrap: on
line diff
--- a/libinterp/corefcn/event-manager.h	Sun Jan 03 14:39:31 2021 -0500
+++ b/libinterp/corefcn/event-manager.h	Thu Dec 17 20:18:51 2020 -0500
@@ -195,6 +195,9 @@
 
     virtual void unregister_doc (const std::string& /*file*/) { }
 
+    virtual void interpreter_output (const std::string& /*msg*/) { }
+
+
     virtual void gui_status_update (const std::string& /*feature*/,
                                     const std::string& /*status*/) { }
 
@@ -503,6 +506,17 @@
         return false;
     }
 
+    bool interpreter_output (const std::string& msg)
+    {
+      if (enabled ())
+        {
+          instance->interpreter_output (msg);
+          return true;
+        }
+      else
+        return false;
+    }
+
     bool gui_status_update (const std::string& feature, const std::string& status)
     {
       if (enabled ())