3 // SWIG file embedding the Python interpreter in something else.
 
   4 // This file is based on Python-1.5.  It will not work with
 
   7 // This file makes it possible to extend Python and all of its
 
   8 // built-in functions without having to hack it's setup script.
 
  15 This module provides support for building a new version of the
 
  16 Python executable.  This will be necessary on systems that do
 
  17 not support shared libraries and may be necessary with C++
 
  18 extensions.  This file contains everything you need to build
 
  19 a new version of Python from include files and libraries normally
 
  20 installed with the Python language.
 
  22 This module will automatically grab all of the Python modules
 
  23 present in your current Python executable (including any special
 
  24 purpose modules you have enabled such as Tkinter).   Thus, you
 
  25 may need to provide additional link libraries when compiling.
 
  27 This library file only works with Python 1.5.  A version 
 
  28 compatible with Python 1.4 is available as embed14.i and
 
  29 a Python1.3 version is available as embed13.i.    As far as
 
  30 I know, this module is C++ safe.
 
  33 %echo "embed.i : Using Python 1.5"
 
  43 void SWIG_init();  /* Forward reference */
 
  45 #define _PyImport_Inittab swig_inittab
 
  47 /* Grab Python's inittab[] structure */
 
  54 #undef _PyImport_Inittab 
 
  56 /* Now define our own version of it.
 
  57    Hopefully someone does not have more than 1000 built-in modules */
 
  59 struct _inittab _SwigImport_Inittab[1000];       
 
  61 static int  swig_num_modules = 0;
 
  63 /* Function for adding modules to Python */
 
  65 static void swig_add_module(char *name, void (*initfunc)()) {
 
  66         _SwigImport_Inittab[swig_num_modules].name = name;
 
  67         _SwigImport_Inittab[swig_num_modules].initfunc = initfunc;
 
  69         _SwigImport_Inittab[swig_num_modules].name = (char *) 0;
 
  70         _SwigImport_Inittab[swig_num_modules].initfunc = 0;
 
  73 /* Function to add all of Python's build in modules to our interpreter */
 
  75 static void swig_add_builtin() {
 
  77         while (swig_inittab[i].name) {
 
  78                 swig_add_module(swig_inittab[i].name, swig_inittab[i].initfunc);
 
  84         /* Add SWIG builtin function */
 
  85         swig_add_module(SWIG_name, SWIG_init);
 
  96 extern int Py_Main(int, char **);
 
 102 extern struct _inittab *PyImport_Inittab;
 
 105 main(int argc, char **argv) {
 
 107         PyImport_Inittab = _SwigImport_Inittab;
 
 108         return Py_Main(argc,argv);