This commit is contained in:
John Cupitt 2007-12-14 12:40:39 +00:00
parent fd3644c340
commit 95e5712510
4 changed files with 27 additions and 11 deletions

View File

@ -1,5 +1,6 @@
12/12/07 started 7.13.3
- added "include <cstring>" to VImage.cc to help gcc 4.3
- started moving the python binding to dynamic wrapping
31/10/07 started 7.13.2
- build cimg on windows fixes

View File

@ -238,9 +238,13 @@ public:
void initdesc( int, int, int, TBandFmt, TCoding, TType,
float = 1.0, float = 1.0, int = 0, int = 0 ) throw( VError );
/* Bindings wrap databased operations at runtime using reflection.
*/
#ifndef SWIG
/* Insert automatically generated headers.
*/
#include "vipsc++.h"
#endif /*SWIG*/
/* No point getting SWIG to wrap these ... we do this by hand later so we can
* handle things like "a + 12" correctly.
@ -389,7 +393,7 @@ public:
VIPS_NAMESPACE_END
// Other VIPS protos
// Other VIPS protos we need
extern "C" {
extern int im_init_world( const char *argv0 );
extern void im__print_all();

View File

@ -1,3 +1,5 @@
INCLUDES = -I${top_srcdir}/include @VIPS_CFLAGS@ @VIPS_INCLUDES@ @PYTHON_INCLUDES@
# we install to a directory inside the python area, since we are a module
@ -5,18 +7,15 @@ vipsccdir = $(pyexecdir)/vipsCC
vipscc_PYTHON = VImage.py VDisplay.py VError.py VMask.py __init__.py
# need an expanded VImage.h ... SWIG's preprocessor b0rks on includes inside
# class definitions
# I tried making a suffix rule for this (and defining SUFFIXES) but I couldn;t
# get it to work, how annoying
# FIXME at some point
vimagemodule.cxx: VImage.i
cpp -DSWIG -E $(top_srcdir)/include/vips/VImage.h > VImage.h
swig -python -c++ -interface $(@:.cxx=) -I$(top_srcdir)/include -o $@ $<
vdisplaymodule.cxx: VDisplay.i
swig -python -c++ -interface $(@:.cxx=) -I$(top_srcdir)/include -o $@ $<
verrormodule.cxx: VError.i
swig -python -c++ -interface $(@:.cxx=) -I$(top_srcdir)/include -o $@ $<
vmaskmodule.cxx: VMask.i
swig -python -c++ -interface $(@:.cxx=) -I$(top_srcdir)/include -o $@ $<
@ -39,7 +38,7 @@ vmaskmodule_la_LIBADD = ../../libsrcCC/libvipsCC.la $(VIPS_LIBS)
nodist_vmaskmodule_la_SOURCES = vmaskmodule.cxx
CLEANFILES = \
vimagemodule.cxx VImage.h \
vimagemodule.cxx \
verrormodule.cxx vdisplaymodule.cxx vmaskmodule.cxx \
VImage.py VDisplay.py VError.py VMask.py

View File

@ -13,6 +13,13 @@
*/
%rename(__assign__) vips::VImage::operator=;
/* We wrap the C++ VImage class as VImage_core, then write the user-visible
* VImage class ourselves with a %pythoncode (see below). Our hand-made VImage
* class wraps all the operators from the VIPS image operation database via
* __getattr__.
*/
%rename(VImage_core) VImage;
%include "std_list.i"
%include "std_complex.i"
%include "std_vector.i"
@ -31,11 +38,16 @@ namespace std {
/* VImage defines a lot of other operator overloads ... but SWIGs autowrapping
* doesn't work well for them. Do by hand later.
*/
%include vips/VImage.h
/* Need the expanded VImage.h in this directory. SWIG b0rks on #includes
* inside class definitions.
/* Now wrap SWIG's VImage_core with our own VImage class which does operations
* from the VIPS operation database.
*/
%include VImage.h
%pythoncode %{
class VImage (VImage_core):
def __getattr__ (self, name):
print "VImage getattr: ", name
%}
/* Helper code for vips_init().
*/