pwig is a SWIG extension that allows new language modules to be programmed in Python. It's mostly a SWIG wrapper for SWIG itself ;-)
A fully working module for SWI-Prolog is included on the pwig distribution.
You can download pwig latest version from the SourceForge site
To install pwig first you need to create a patched SWIG: Download SWIG-1.3.23 from the SWIG website and apply the path included with the pwig distribution. Rerun autogen.sh (optional, but recommended if you have the autotools installed), configure, make and install the resulting package:
$ tar xzf SWIG-1.3.23.tar.gz $ cd SWIG-1.3.23 $ patch -p0 <.../pwig-x.x.x/patchs/swig-1.3.23.patch $ ./autogen.sh # optional $ ./configure $ make $ make install
Then, you can install pwig with the usual
make install commands.
--with-swig=... to point to the patched SWIG:
$ ./configure --with-swig=/path/to/the/patched/swig $ make $ make install
Step by step instructions are included on the
INSTALL.pwig file from the pwig
There are several examples of wrapper generation with the SWI-Prolog module included.
To run them ...
$ cd examples/swipl/foo $ make $ mv config_sample.pl config.pl $ vi config.pl # set Logtalk config $ make test
Remember that they need SWI-Prolog and Logtalk to work.
Docs about how to write new pwig modules are not available yet, but you can use the source from the SWI-Prolog module as an example.
Most of the extending SWIG docs still apply although you should be aware that several function and method names have been transformed to make them more consistent with Python common uses (greping the .i files for 'rename' reveals such transformations that are mostly prefix eliminations and case changes).
Docs about the SWI-Prolog module are available from here, you should also read the SWIG core documentation.
I really like getting feedback about people using pwig, which kind of projects it's being used for, problems found, bugs, how can it be improved, etc. Use the project lists at SourceForge to send comments and questions and the bug tracking system to report bugs or if you don't like posting mails in public list, you can also send your comments to my personal address.
pwig project resources (CVS, downloads, bugs, mainling list, etc.) at SourceForge: http://sourceforge.net/projects/pwig