summaryrefslogtreecommitdiff
path: root/wrap/otk_timer.i
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-03-21 18:43:51 +0000
committerDana Jansens <danakj@orodu.net>2003-03-21 18:43:51 +0000
commitb2babc8b0a97b68791304ce899d10a4835db45fb (patch)
treef54eb8b0c1139193c6f4d68412aab8bf217e5343 /wrap/otk_timer.i
parenta52a6d96d701c993896f276e4198003317632aaf (diff)
rm the obsetroot tool and the wrap shit from swig
Diffstat (limited to 'wrap/otk_timer.i')
-rw-r--r--wrap/otk_timer.i78
1 files changed, 0 insertions, 78 deletions
diff --git a/wrap/otk_timer.i b/wrap/otk_timer.i
deleted file mode 100644
index 9f9eb77e..00000000
--- a/wrap/otk_timer.i
+++ /dev/null
@@ -1,78 +0,0 @@
-// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
-
-%module otk_timer
-
-%{
-#include "config.h"
-#include "timer.hh"
-%}
-
-%{
- struct PythonCallbackData {
- PyObject *pyfunc;
- void *data;
- };
-
- /*
- Calls a python callback for the TimeoutHandler function type
- */
- static void PythonCallback(PythonCallbackData *calldata) {
- PyObject *arglist, *result;
-
- arglist = Py_BuildValue("(O)", calldata->data);
-
- // call the callback
- result = PyEval_CallObject((PyObject*)calldata->pyfunc, arglist);
- if (!result || PyErr_Occurred()) {
- // an exception occured in the script, display it
- PyErr_Print();
- }
-
- Py_XDECREF(result);
- Py_DECREF(arglist);
- }
-%}
-
-// Grab a Python function object as a Python object.
-%typemap(python,in) PyObject *func {
- if (!PyCallable_Check($input)) {
- PyErr_SetString(PyExc_TypeError, "Excepting a callable object.");
- return NULL;
- }
- $1 = $input;
-}
-
-namespace otk {
-
-%ignore Timer::Timer(long, TimeoutHandler, void*);
-%ignore Timer::operator delete(void*);
-%ignore Timer::initialize();
-%ignore Timer::destroy();
-%ignore Timer::dispatchTimers(bool);
-%ignore Timer::nearestTimeout(struct timeval&);
-
-%extend Timer {
- Timer(long, PyObject*, PyObject*);
-
- // if you don't call stop() before the object disappears, the timer will
- // keep firing forever
- void stop() {
- delete self;
- }
-}
-
-}
-
-%{
- static otk::Timer *new_otk_Timer(long delay,
- PyObject *func, PyObject *data) {
- PythonCallbackData *d = new PythonCallbackData;
- d->pyfunc = func;
- d->data = data;
- return new otk::Timer(delay,
- (otk::Timer::TimeoutHandler)&PythonCallback, d);
- // the PythonCallbackData is leaked.. XXX
- }
-%}
-
-%include "timer.hh"