summaryrefslogtreecommitdiff
path: root/Lib/python/python.swg
blob: d38e0ff168a022f5250f848ad1ccb3d46185e1bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* -----------------------------------------------------------------------------
 * python.swg
 *
 * Python configuration module.
 * ----------------------------------------------------------------------------- */

/* Python.h has to appear first */

%insert(runtime) %{
#include "Python.h"
%}

%insert(runtime) "precommon.swg";
%insert(runtime) "common.swg";          /* Common type-checking code */
%insert(runtime) "pyrun.swg";           /* Python run-time code */

/* Special directive for shadow code */

#define %shadow      %insert("shadow")
#define %pythoncode  %insert("python")

%include "pymacros.swg"


/* -----------------------------------------------------------------------------
 *  SWIGTYPE typemaps
 * ----------------------------------------------------------------------------- */

%include "pyswigtype.swg"

/* -----------------------------------------------------------------------------
 *  Typemap specializations
 * ----------------------------------------------------------------------------- */

%include "pyinout.swg"
%include "pyvoid.swg"
%include "pyobject.swg"
%include "pystrings.swg"
%include "pywstrings.swg"
%include "pyvaltypes.swg"
%include "pyptrtypes.swg"
%include "pyprimtypes.swg"
%include "pymisctypes.swg"

/* ------------------------------------------------------------
 *  Enums 
 * ------------------------------------------------------------ */
%apply int { enum SWIGTYPE };
/* this doesn't work now, you need to redefined it for each enum. */
%apply const int& { const enum SWIGTYPE& };


/* ------------------------------------------------------------
 *  Overloaded operator support
 * ------------------------------------------------------------ */
%include "pyopers.swg"

/* ------------------------------------------------------------
 * Warnings for Python keywords 
 * ------------------------------------------------------------ */
%include "pythonkw.swg"

/* ------------------------------------------------------------
 * The start of the Python initialization function 
 * ------------------------------------------------------------ */

%init %{
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT(void) SWIG_init(void) {
  static PyObject *SWIG_globals = 0; 
  static int       typeinit = 0;
  PyObject *m, *d;
  int       i;
  if (!SWIG_globals) SWIG_globals = SWIG_newvarlink();
  m = Py_InitModule((char *) SWIG_name, SwigMethods);
  d = PyModule_GetDict(m);

  if (!typeinit) {
     for (i = 0; swig_types_initial[i]; i++) {
        swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
     }
     typeinit = 1;
  }
  SWIG_InstallConstants(d,swig_const_table);
%}