Plugins


Siag Office - A Free Office Package for Unix

News

Scheme In A Grid

Pathetic Writer

Egon Animator

Supporting Environment

Plugins

Form Input

Extension Languages

Drag and Drop

Getting Siag

Credits

FTP Archive

Mail Archive

The GNU Public License

Change Log

More stuff

An application that can handle many types of data is very complex. As a result, it is difficult to use, time-consuming to write and impossible to extend.

What if one could write applications that do a single thing well, and invoke external applications for everything else? Want to display an image? Sure! Just tell the main application what plugin can handle that image type and off you go. Want to display a table in your word processor? Plug in a spreadsheet!

In order to integrate the two applications well, they need to know about each other. There must be a protocol that allows them to communicate. The protocol used by Siag Office is very simple and uses standard Unix pipes for the communication. The plugin reads commands from stdin and prints replies on stdout. All of this is of course completely transparent to the user. Plugins can even be nested, so that a plugin can itself have plugins.

All of the main applications in Siag Office can load and display plugins, and are also able to themselves function as a plugin. There are also a few additional plugins.

Configuration

Before Siag can use a plugin, it must know that the plugin exists. To do this, there is a file called $SIAGHOME/plugins/plugin.scm which contains the necessary Scheme code. Additional plugins can be registered by adding them to plugin.scm. A user can add his own plugins by registering them in the personal configuration files for the respective applications ($HOME/.siag/siag.scm, $HOME/.siag/pw.scm and $HOME/.siag/egon.scm),

The Image Plugin

One of the plugins that are supplied with Siag Office is the image plugin. It displays most common image formats if the NETPBM collection of graphics converters is installed. Otherwise it will be able to display XPM images.

The plugin has no facilities for editing or otherwise manipulating the images; for that you have to use another application.

The Dummy Plugin

Of course, most existing applications have no understanding of the communication protocol. The dummy application works as a "shim" between Siag and another application. It speaks the plugin protocol with Siag and does its best to manage the external application.

Due to the fact that the "kidnapped" applications do not speak the communications protocol for plugins used by the Siag Office suite, there may be no way to do things that would be expected from normal plugins, such as loading or saving files, printing or even terminating gracefully. Still most applications work fine, including xterm, Emacs and Netscape, as well as simple ones like xclock or xeyes.

Configuring the Dummy Plugin

The dummy plugin has its own configuration files. There is a system-wide configuration file in $SIAGHOME/plugins/dummy.scm and a personal configuration file in $HOME/.siag/dummy.scm.

The Hello Plugin

This one is for demonstrational purposes only: it displays the message "Hello, World" in its window. It is suitable as an example of a simple plugin, in that it contains all the necessary code to make a plugin of a normal X program.

Loading and Saving

There are two way to include a plugin in a document: linking or importing. A plugin that is imported is saved as part of the main document. A linked plugin stays in a separate file and can be shared between several applications. As long as the document stays on the same machine, it doesn't matter much which way it is plugged in, but importing is better for documents that will be copied to other locations.

The file format is based on tar, so it can easily be dissected and contents inspected. Secret file formats are bad.

A plugin can be exported to a separate document. This requires that the plugin has saving capabilities; that is not necessarily the case for the dummy plugin.


Ulric Eriksson 2000-12-07