This is a modified version of Jack Jensen's modulator tool.
It is modified to make it feasible to regenerate the skeleton
file as more objects (types really) and methods are added,
without destroying previous work. It does this by using a
number of include files where all your editing should go,
i.e. *never* edit the generated file.

The generated code includes module definition files and
object definition files. They are called:

 <abbrev>_impl.i

In the module definition file, you put in macro definitions
for the global functions. Using EXAMPLE.py, which defines
a module called 'sample', the module definition file is
called 'sample_impl.i'. The module defines the functions

 newsimple
 newnumberish
 newott

Each of these are implemented with an implementation macro
called '<module>_<function>_impl'

E.g.:

 #define sample_newsimple_impl(args) \
 ...

This used to be the only way to implement functions, which
can be very annoying to debug. Therefore I added a way to
implement them with a separate C function. Unfortunately,
the <abbrev>_impl.i file is included too early for
implementing many functions. By defining the macro
<abbrev>_TAIL, a second include file is included by the
generated file at a more appropriate location. The tail
file is called <abbrev>_tail.i. In there you can stick in
the implementations as C functions:

PyObject* <module>_<function>_(PyObject* args)
{
 ...
}

or, for objects

PyObject* <objname>_<memberfun>_(<objname>Object* self, ...)
{
 ...
}


Yes, I know this is not very elegant, and maybe I should have
skipped the macro stuff. If enough people complain, I might
do that (as I said, the macro stuff came first and I didn't
want to rewrite all the code I had).

The object definition file must also define the layout of the
object. This is done with the <objname>_struct macro.

SUMMARY
=======

In <module>_impl.i, either write:

#define <module>_<fun1>_impl(args) ...
#define <module>_<fun2>_impl(args) ...
..

or

#define <module>_TAIL 1

(or a combination. If the implementation macro is not defined,
it is assumed there exist a function <module>_<fun>_)

In <objname>_impl.i, always define the members:

#define MyObj_struct \
 int   anInt; \
 float aFloat;

For methods, either use macros, as for global functions, or
use the <objname>_TAIL trick and implement them in the
<objname>_tail.i file.

If this description makes no sense, don't hesitate to bug
me about it.

BUGS
====

I've basically just tested stuff I use myself, which does not
include things like numberlike types, sequence types, struct
types, etc. If you find problems with it, mail me your problems.
If you fix your problems, mail me the solutions. Thanks.
-----------------------------------------------------------
Daniel Larsson
ABB Industrial Systems AB
[email protected]