octave-maintainers
[Top][All Lists]
Advanced

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

[RFC] External control of Octave via IPC


From: Søren Hauberg
Subject: [RFC] External control of Octave via IPC
Date: Mon, 19 Jan 2009 22:12:07 +0100

Hi All

Once in a while there are discussions about creating a graphical user
interface for interacting with Octave. Basically such an interface
consists of

  1) A "fancy" terminal that graphically shows your history, your
     current variables, etc...

  2) An editor that integrates with the current Octave process, such
     that the user can set breakpoints, step through programs, ...

This mail is about the second point. One way of doing this is to create
out own editor and run this in the Octave process. The good thing about
such an idea is that the interaction with Octave is fairly easy to
program. The downside is, however, that many users already have a
prefered editor, and really don't want to switch to a new one.

I think the best solution is to provide some framework for different
processes to interact with Octave, and use this framework to extend
different editors. Basically, I suggest we incorporate some means of
interprocess communication (IPC) inside of Octave.

I've been playing a bit around with DBus [1] (this is the IPC framework
that Gnome and KDE uses) for this task, and it seems to be fairly easy
to work with. I've extended the 'gnu_readline' function in
'src/input.cc' to include the following lines

  bool ipc_has_commands = false;
  ipc_server.handle_requests (retval, ipc_has_commands);
  if (ipc_has_commands)
    return retval;

where 'ipc_server' handles communication via DBus (quick'n'dirty code
for this is attached in case you're interested). What this does is that
external processes can send commands to Octave via DBus, which Octave
will execute the next time it's idle. What this means is that an editor
can be extended to send commands (such as 'dbstep') to an Octave
process. As a proof-of-concepts I've extended Gedit (the Gnome text
editor) such that you can do simple things such as setting breakpoints
and stepping, and it seems like it should work (it's still quite early
though). This seems like a fairly easy task, and I assume it would also
be fairly easy for other editors (Emacs, Vim, ...).

Anyway, this mail is getting too long... Does anybody have any thoughts
on the subject?

Soren

[1] http://dbus.freedesktop.org/

Attachment: dbus_server.cc
Description: Text Data


reply via email to

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