PLplot
5.12.0
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
plplot_widgetmodule.c
Go to the documentation of this file.
1
// C code to create dynamically loaded library to implement plplot_widget module
2
3
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
4
#include <Python.h>
5
#include <arrayobject.h>
6
#include "
plplot.h
"
7
#include "
plplotP.h
"
8
9
#ifdef ENABLE_tkX
10
#include <tcl.h>
11
#include "
pltk.h
"
12
#endif
13
14
void
initplplot_widget
(
void
);
15
16
#define TRY( E ) if ( !( E ) ) return NULL
17
18
#ifdef ENABLE_tkX
19
static
char
doc_Pltk_init[] =
"Initialize the Pltk Tcl extension."
;
20
21
//--------------------------------------------------------------------------
22
// A python module method for initializing the PLtk extension. This method
23
// must be called from python with a single argument, which is the address of
24
// the Tcl interpreter into which the Pltk extension is to be injected.
25
//--------------------------------------------------------------------------
26
27
static
PyObject *pl_Pltk_init( PyObject *
PL_UNUSED
(
self
), PyObject *args )
28
{
29
//printf( "in pl_Pltk_init()\n" );
30
long
x = 0;
31
32
TRY
( PyArg_ParseTuple( args,
"l"
, &x ) );
33
34
if
( !x )
35
{
36
printf(
"Something went wrong...\n"
);
37
Py_INCREF( Py_None );
38
return
Py_None;
39
}
40
41
Tcl_Interp *
interp
= (Tcl_Interp *) x;
42
43
//printf( "Tcl_Interp * = %ld \n", x );
44
45
if
(
Pltk_Init
( interp ) == TCL_ERROR )
46
{
47
printf(
"Initialization of Pltk Tcl extension failed!\n"
);
48
return
NULL;
49
}
50
51
//printf( "plframe has been installed into the Tcl interpreter.\n" );
52
53
Py_INCREF( Py_None );
54
return
Py_None;
55
}
56
57
#endif
58
59
//--------------------------------------------------------------------------
60
61
static
PyMethodDef
plplot_widget_methods
[] = {
62
#ifdef ENABLE_tkX
63
{
"Pltk_init"
, pl_Pltk_init, METH_VARARGS, doc_Pltk_init },
64
#endif
65
66
{ NULL, NULL, 0, NULL }
67
};
68
69
PLDLLIMPEXP_PLPLOT_WIDGETMODULE
void
initplplot_widget
(
void
)
70
{
71
PyObject *m;
72
//PyObject *d;
73
74
import_array();
75
76
// Create the module and add the functions
77
m = Py_InitModule(
"plplot_widget"
, plplot_widget_methods );
78
PyModule_GetDict( m );
79
80
// Check for errors
81
if
( PyErr_Occurred() )
82
Py_FatalError(
"plplot_widget module initialization failed"
);
83
}
plplotP.h
plplot_widget_methods
static PyMethodDef plplot_widget_methods[]
Definition:
plplot_widgetmodule.c:61
TRY
#define TRY(E)
Definition:
plplot_widgetmodule.c:16
PL_UNUSED
#define PL_UNUSED(x)
Definition:
plplot.h:128
Pltk_Init
EXTERN PLDLLIMPEXP_TCLTK int Pltk_Init(Tcl_Interp *interp)
Definition:
Pltk_Init.c:51
pltk.h
initplplot_widget
void initplplot_widget(void)
Definition:
plplot_widgetmodule.c:69
interp
static Tcl_Interp * interp
Definition:
tkMain.c:120
plplot.h
plplot_source
bindings
python
plplot_widgetmodule.c
Generated on Sat Jan 28 2017 17:51:02 for PLplot by
1.8.8