[GRASS-dev] GRASS-Swig-PERL interface 2

Hi all,

finally I have added Ari's new swig/perl2/ interface to CVS.
It is substantially simplified and now generated wrapper
functions for all raster and all vector modules (more
could be easily added in the make.pl.in file there).

Best

Markus

On Mon, Mar 06, 2006 at 10:14:49AM +0200, Ari Jolma wrote:

I advanced a bit from what I described on the list. My current
approach is based on one single Perl script (attached), which writes the
swig interface files and builds everything. The perl subdir is not
needed and these three files go directly to the swig directory.

Hmm, I also made some small changes into gisdefs.h directly into the
i686-pc-linux copy... (basically commented out the non-existing API
which Swig does not like).

make.pl builds Perl modules for grass and all raster commands. Adding
vector commands is in theory as simple as adding one line into this
script. Building some command modules surely fails, but I've not looked
into that. Building of the command modules happens in these steps
(commented also in make.pl):

1. make copies of source code and patch the main.c
2. compile the source code and make an archive file (I use Perl's
Makefile.PL based system for this also)
3. create the wrapper code with Swig
4. create the dynamic library and the module (Perl's Makefile.PL based
system). Also makes and runs test code optionally.

This seems to work for many, if not most, raster commands

I think the biggest problem is the text-based i/o of usage, errors etc.
But that may not be a big problem if one just wants to write scripts.

Also the tight link to Grass database is a problem for me, I'd like to
use GDAL/OGR to access the data, give the data (ref to it) on-line to
Grass for analysis, then take the data into my own GUI, etc. But for
example I tried importing a large raster to Grass using GDAL and that
was so slow that it is not feasible for interactive work.

Please try this and see if you get it to work. Ask me in case of problems.

Ari