Scripting


Subject: Scripting
From: David Mandelin (mandelin@cs.wisc.edu)
Date: Wed Aug 15 2001 - 14:55:19 CDT


The attachment is a patch that makes AbiWord into a crude out-of-process
COM server. It should be usable on Windows from Python/Perl/VB/VBS/C++
clients. Right now about all you can do is open documents, navigate the
document-section-block tree, and view text inside blocks. You can also
modify the text and save, but modifying text causes an assert failure in
the UI (something with cursor positioning). The code isn't efficient,
and it doesn't handle errors.

Anyway, exposing COM objects from AbiWord isn't too hard, and a decent
fraction of the code should be XP. But it will be quite a bit of work,
and there are some architectural issues I'd like to bring up instead of
spending 2 months on this and then finding out everyone hates it.

1. In this patch, AbiWord is single-threaded, and script method calls
run on the same thread. This means AbiWord needn't be thread-safe, but
scripts are hard because the user can do something in the UI between 2
script method calls. I'd like to add a mutex that allows one script to
lock out the UI and other scripts for short periods. Thoughts?

2. Some things that would be typical in a scripting interface seem a
little tricky. It may just be that I don't know the source well enough
yet. For example, I made a Documents object. It's a collection of all
open documents. AFAICT, there is no explicit table of open documents in
AbiWord. And I found no clean way to get notified when documents are
opened or closed. Is refactoring to improve scripting support a good
idea, or a bad idea?

3. I'm using ATL. Is this OK? ATL will probably come out anyway once the
exported objects go to more of an XP framework.

Of course, comments on the patch are welcome.



The attachment is a patch that makes AbiWord into a crude
out-of-process COM server. It should be usable on Windows from
Python/Perl/VB/VBS/C++ clients.

To build, you will need regrgs.exe, which applies .rgs files to the
Registry. It is available from Microsoft in Knowledge Base article
Q220836.



This archive was generated by hypermail 2b25 : Wed Aug 15 2001 - 14:55:27 CDT