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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
/* -*- Mode: C; c-basic-offset: 4 -*- */
/* cplplotcanvas.override - C python wrapper override for plplotcanvas
Copyright (C) 2004, 2005 Thomas J. Duck
All rights reserved.
Thomas J. Duck <tom.duck@dal.ca>
Department of Physics and Atmospheric Science,
Dalhousie University, Halifax, Nova Scotia, Canada, B3H 3J5
NOTICE
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
*/
/*-------------------------------------------------------------------------*/
/* */
/* NOTES */
/* */
/* ignore-glob section: */
/* */
/* Methods in the plplot common library that can be wrapped have */
/* been removed from the list. */
/* */
/* Plplot methods with constant arguments are wrapped automatically. */
/* */
/* Commonly-used routines with non-constant arguments are wrapped using */
/* overrides, below, if required for speed. */
/* */
/* Routines that cannot be automatically wrapped are called from python */
/* code in plplotcanvas.Canvas using __getattr__. */
/* */
/*-------------------------------------------------------------------------*/
%%
headers
#include <Python.h>
#include "pygobject.h"
#include "plplot.h"
#include "plplotcanvas.h"
#define PY_ARRAY_UNIQUE_SYMBOL plplotcanvasapi
#include "arrayobject.h"
%%
%%modulename c_plplotcanvas
%%
import gnomecanvas.Canvas as PyGnomeCanvas_Type
%%
ignore-glob
*_get_type
plplot_canvas_arrows
plplot_canvas_vect
plplot_canvas_svect
plplot_canvas_axes
plplot_canvas_bin
plplot_canvas_box
plplot_canvas_box3
plplot_canvas_calc_world
plplot_canvas_cont
plplot_canvas_fcont
plplot_canvas_did2pc
plplot_canvas_dip2dc
plplot_canvas_errx
plplot_canvas_erry
plplot_canvas_fill
plplot_canvas_fill3
plplot_canvas_gchr
plplot_canvas_gcol0
plplot_canvas_gcolbg
plplot_canvas_gcompression
plplot_canvas_gdev
plplot_canvas_gdidev
plplot_canvas_gdiori
plplot_canvas_gdiplt
plplot_canvas_glevel
plplot_canvas_gpage
plplot_canvas_griddata
plplot_canvas_gspa
plplot_canvas_gver
plplot_canvas_gvpd
plplot_canvas_gvpw
plplot_canvas_gxax
plplot_canvas_gyax
plplot_canvas_gzax
plplot_canvas_hist
plplot_canvas_lab
plplot_canvas_line3
plplot_canvas_map
plplot_canvas_meridians
plplot_canvas_mesh
plplot_canvas_meshc
plplot_canvas_plmtex
plplot_canvas_plot3d
plplot_canvas_plot3dc
plplot_canvas_plot3dcl
plplot_canvas_pat
plplot_canvas_poin
plplot_canvas_poin3
plplot_canvas_poly3
plplot_canvas_ptex
plplot_canvas_scmap0
plplot_canvas_gcmap0n
plplot_canvas_scmap1
plplot_canvas_scmap1l
plplot_canvas_shade
plplot_canvas_shade1
plplot_canvas_shades
plplot_canvas_fshade
plplot_canvas_image
plplot_canvas_styl
plplot_canvas_surf3d
plplot_canvas_surf3dl
plplot_canvas_sym
plplot_canvas_xormod
%%
override plplot_canvas_new args, kwargs
static int
_wrap_plplot_canvas_new(PyGObject *self, PyObject *args, PyObject *kwargs)
{
GType obj_type = pyg_type_from_object((PyObject *) self);
self->obj = g_object_new(obj_type, "aa", TRUE, NULL);
if (!self->obj) {
PyErr_SetString(PyExc_RuntimeError, "could not create %(typename)s object");
return -1;
}
pygobject_register_wrapper((PyObject *)self);
return 0;
}
%%
override plplot_canvas_line args
static PyObject* _wrap_plplot_canvas_line(PyGObject *self,
PyObject *args)
{
PyObject *x_,*y_;
PyArrayObject *x, *y;
if(!PyArg_UnpackTuple(args,"ref",2,2,&x_,&y_))
return NULL;
if(!PyArray_Check(x_)) return NULL;
if( (x = (PyArrayObject *)
PyArray_ContiguousFromObject(x_, PyArray_DOUBLE, 1, 1)) == NULL)
return NULL;
if(!PyArray_Check(y_)) return NULL;
if( (y = (PyArrayObject *)
PyArray_ContiguousFromObject(y_, PyArray_DOUBLE, 1, 1)) == NULL)
return NULL;
plplot_canvas_line(PLPLOT_CANVAS(self->obj),
x->dimensions[0],(double*)x->data,(double*)y->data);
return Py_BuildValue("");
}
|