GEdit OPI plugin

Yves Jaradin yves.jaradin at uclouvain.be
Mon Feb 18 10:08:50 CET 2008


Le samedi 16 février 2008 à 23:55 +0100, Simon van der Linden a écrit :
> Hi,
> 
> I'm one of the students of Peter Van Roy who have had the idea to 
> develop a GEdit plugin for Mozart. So far, we only played a bit with 
> gedit, its plugin class, and PyGTK.
> 
> However, Yves Jaradin (are you reading this, Yves?), 
Yes, I am. ;-)
> wrote some piece of 
> code and gave it to me. I read it last week, but had some difficulties 
> to understand it and the OPI.
> 
> The first thing is that I'm not an Emacs lover, and I think I won't ever 
> get used to it. I hardly used the Emacs plugin for Oz, but Vi and 
> ozc-ozengine instead. So, I may have another point of view on the GEdit 
> plugin we'd like to develop.
> 
> My idea is very simple: to have an oz browser in the bottom pane, and a 
> "Feed Mozart with the selection" action in the right-click-menu. Perhaps 
> we could also have some translation tools, such as a kernel language 
> code generator.
Well, for the "Feed Mozart with the selection" part, that's easy. For
the Browser in a GTk pane part, it's much more complex. The Browser has
to take care (at least) of concurrency, cycles and computation spaces.
The GUI part would be quite trivial compared to this. Unfortunately, it
is difficult to reuse code from the current Browser as its is tightly
bound to Tcl/Tk and written in "Old Oz".
> 
> I'd like to implement this in a Gnome-ish way, and I don't want to move 
> the Emacs OPI to GEdit.
Fine, I did port the Emacs OPI because I was sure that it was
feature-complete enough to be usable without having to think about lots
of use cases etc. and I wanted a basic plugin working as fast as
possible. 
> 
> The second thing is that I don't get really well the design of the OPI 
> functor. Why does it open an inet socket, which binds on a random port 
> on every interface? Why not an unix one? It would be easier than reading 
> the stdout to get a list of the port digits ;-)
Portability. Unix sockets are, well, Unix-only and don't have much
support in Oz. Also the OPI functor I wrote for this gedit prototype is
quite generic and could be used by other plugins for other editors
regardless of the platform.
> 
> I'll have a deeper look at the OPI asap, but I'm wondering if it exists 
> some doc about the "protocol" somewhere on the Internet. Could you help me?
Considering that the source is available and in a documented programming
language, yes it's kind of documented ;-) Of course, I will help you
where I can. In the current/old OPI, two protocols are defined. On is
actuallly used but quite ad-hoc, the other is cleaner, not used and
incomplete. The prototype/new OPI protocol is inspired by this last one.
The idea is that a message is a list of strings. For this, three special
characters are used. One to separate messages, one to separate the
strings inside the message and one as an escape so that the strings can
contain the special characters. 
> 
> Regards,
> 
Yves



More information about the mozart-hackers mailing list