PyObject *py_ped_timer_new_nested(PyObject *s, PyObject *args) { float nest_frac; PedTimer *parent = NULL, *timer = NULL; _ped_Timer *ret = NULL; if (!PyArg_ParseTuple(args, "f", &nest_frac)) return NULL; parent = _ped_Timer2PedTimer(s); if (parent == NULL) { return NULL; } timer = ped_timer_new_nested(parent, nest_frac); ped_timer_destroy(parent); if (timer) { ret = PedTimer2_ped_Timer(timer); } else { PyErr_SetString(CreateException, "Could not create new nested timer"); return NULL; } ped_timer_destroy(timer); return (PyObject *) ret; }
PyObject *py_ped_timer_reset(PyObject *s, PyObject *args) { PedTimer *timer = NULL; timer = _ped_Timer2PedTimer(s); if (timer == NULL) { return NULL; } ped_timer_reset(timer); ped_timer_destroy(timer); Py_INCREF(Py_None); return Py_None; }
PyObject *py_ped_timer_update(PyObject *s, PyObject *args) { float frac; PedTimer *timer = NULL; if (!PyArg_ParseTuple(args, "f", &frac)) return NULL; timer = _ped_Timer2PedTimer(s); if (timer == NULL) { return NULL; } ped_timer_update(timer, frac); ped_timer_destroy(timer); Py_INCREF(Py_None); return Py_None; }
PyObject *py_ped_geometry_check(PyObject *s, PyObject *args) { PyObject *in_timer = NULL; PedGeometry *geom = NULL; PedSector offset, granularity, count, ret; PedTimer *out_timer = NULL; char *out_buf = NULL; if (!PyArg_ParseTuple(args, "LLL|O!", &offset, &granularity, &count, &_ped_Timer_Type_obj, &in_timer)) { return NULL; } geom = _ped_Geometry2PedGeometry(s); if (geom == NULL) { return NULL; } if (!geom->dev->open_count) { PyErr_Format(IOException, "Device %s is not open.", geom->dev->path); return NULL; } if (geom->dev->external_mode) { PyErr_Format(IOException, "Device %s is already open for external access.", geom->dev->path); return NULL; } if (in_timer) out_timer = _ped_Timer2PedTimer(in_timer); else out_timer = NULL; if ((out_buf = malloc(geom->dev->sector_size * 32)) == NULL) { ped_timer_destroy(out_timer); return PyErr_NoMemory(); } ret = ped_geometry_check(geom, out_buf, 32, offset, granularity, count, out_timer); ped_timer_destroy(out_timer); free(out_buf); return PyLong_FromLongLong(ret); }
PyObject *py_ped_timer_set_state_name(PyObject *s, PyObject *args) { char *str = NULL; PedTimer *timer = NULL; if (!PyArg_ParseTuple(args, "z", &str)) { return NULL; } timer = _ped_Timer2PedTimer(s); if (timer == NULL) { return NULL; } ped_timer_set_state_name(timer, str); ped_timer_destroy(timer); free(str); Py_INCREF(Py_None); return Py_None; }