diff options
author | Guido van Rossum <guido@python.org> | 2007-05-11 16:50:42 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-05-11 16:50:42 (GMT) |
commit | 0368b726a1859e3c063df5a93f19ccb4254be22a (patch) | |
tree | 4e65a593d48f9103facb47b741f8ed97d755286f /Modules | |
parent | bdde01168fc91d02a2d3bc8399255944fdfdd69f (diff) | |
download | cpython-0368b726a1859e3c063df5a93f19ccb4254be22a.zip cpython-0368b726a1859e3c063df5a93f19ccb4254be22a.tar.gz cpython-0368b726a1859e3c063df5a93f19ccb4254be22a.tar.bz2 |
Merged revisions 55225-55227,55229-55269 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r55238 | guido.van.rossum | 2007-05-10 16:46:05 -0700 (Thu, 10 May 2007) | 9 lines
Merged revisions 55227 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55227 | guido.van.rossum | 2007-05-10 10:20:15 -0700 (Thu, 10 May 2007) | 2 lines
Fix a bug in test_c_api() that caused a negative refcount.
........
................
r55246 | neal.norwitz | 2007-05-11 00:01:52 -0700 (Fri, 11 May 2007) | 1 line
Remove commands.getstatus() it is obsolete.
................
r55248 | neal.norwitz | 2007-05-11 00:29:05 -0700 (Fri, 11 May 2007) | 2 lines
Remove bsddb185 support.
................
r55249 | neal.norwitz | 2007-05-11 00:29:50 -0700 (Fri, 11 May 2007) | 1 line
Remove bsddb185 module too
................
r55250 | neal.norwitz | 2007-05-11 00:32:13 -0700 (Fri, 11 May 2007) | 1 line
bsddb185: Gotta remove from the file checked in, not Setup
................
r55251 | neal.norwitz | 2007-05-11 00:53:26 -0700 (Fri, 11 May 2007) | 1 line
Remove obsolete IRIX modules (as much as I could find, there is probably more)
................
r55252 | neal.norwitz | 2007-05-11 00:55:35 -0700 (Fri, 11 May 2007) | 1 line
Remove SGI turd.
................
r55254 | georg.brandl | 2007-05-11 03:11:01 -0700 (Fri, 11 May 2007) | 2 lines
Add a case for set comprehensions to the "cannot assign to" switch.
................
r55255 | georg.brandl | 2007-05-11 03:11:25 -0700 (Fri, 11 May 2007) | 2 lines
Fix wrong imports.
................
r55261 | georg.brandl | 2007-05-11 07:37:48 -0700 (Fri, 11 May 2007) | 2 lines
Remove removed tex files.
................
r55262 | georg.brandl | 2007-05-11 08:28:41 -0700 (Fri, 11 May 2007) | 2 lines
Commit PEP 3132 implementation.
................
r55264 | georg.brandl | 2007-05-11 08:50:19 -0700 (Fri, 11 May 2007) | 2 lines
Check in the inevitable AST version number and format Py_ssize_t with %zd.
................
r55265 | neal.norwitz | 2007-05-11 09:12:22 -0700 (Fri, 11 May 2007) | 1 line
Remove mention of os.popen* and popen2.* since these will be removed.
................
r55266 | neal.norwitz | 2007-05-11 09:19:57 -0700 (Fri, 11 May 2007) | 1 line
Get doc to build again (almost, the doc is fine)
................
r55267 | neal.norwitz | 2007-05-11 09:21:02 -0700 (Fri, 11 May 2007) | 1 line
Really get doc to build (remove use of string module)
................
r55269 | neal.norwitz | 2007-05-11 09:29:43 -0700 (Fri, 11 May 2007) | 1 line
Add some notes to cleanup later
................
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/Setup.dist | 52 | ||||
-rw-r--r-- | Modules/almodule.c | 3226 | ||||
-rw-r--r-- | Modules/bsddbmodule.c | 858 | ||||
-rw-r--r-- | Modules/cdmodule.c | 796 | ||||
-rw-r--r-- | Modules/cgen.py | 520 | ||||
-rw-r--r-- | Modules/cgensupport.c | 310 | ||||
-rw-r--r-- | Modules/cgensupport.h | 64 | ||||
-rw-r--r-- | Modules/clmodule.c | 2559 | ||||
-rw-r--r-- | Modules/flmodule.c | 2139 | ||||
-rw-r--r-- | Modules/fmmodule.c | 264 | ||||
-rw-r--r-- | Modules/glmodule.c | 7628 | ||||
-rw-r--r-- | Modules/imgfile.c | 504 | ||||
-rw-r--r-- | Modules/parsermodule.c | 23 | ||||
-rw-r--r-- | Modules/sgimodule.c | 55 | ||||
-rw-r--r-- | Modules/svmodule.c | 966 |
15 files changed, 19 insertions, 19945 deletions
diff --git a/Modules/Setup.dist b/Modules/Setup.dist index 173dfcc..363eb8e 100644 --- a/Modules/Setup.dist +++ b/Modules/Setup.dist @@ -133,11 +133,6 @@ zipimport zipimport.c # The Python symtable module depends on .h files that setup.py doesn't track _symtable symtablemodule.c -# The SGI specific GL module: - -GLHACK=-Dclear=__GLclear -#gl glmodule.c cgensupport.c -I$(srcdir) $(GLHACK) -lgl -lX11 - # Pure module. Cannot be linked dynamically. # -DWITH_QUANTIFY, -DWITH_PURIFY, or -DWITH_ALL_PURE #WHICH_PURE_PRODUCTS=-DWITH_ALL_PURE @@ -250,42 +245,6 @@ GLHACK=-Dclear=__GLclear #_sha shamodule.c -# SGI IRIX specific modules -- off by default. - -# These module work on any SGI machine: - -# *** gl must be enabled higher up in this file *** -#fm fmmodule.c $(GLHACK) -lfm -lgl # Font Manager -#sgi sgimodule.c # sgi.nap() and a few more - -# This module requires the header file -# /usr/people/4Dgifts/iristools/include/izoom.h: -#imgfile imgfile.c -limage -lgutil -lgl -lm # Image Processing Utilities - - -# These modules require the Multimedia Development Option (I think): - -#al almodule.c -laudio # Audio Library -#cd cdmodule.c -lcdaudio -lds -lmediad # CD Audio Library -#cl clmodule.c -lcl -lawareaudio # Compression Library -#sv svmodule.c yuvconvert.c -lsvideo -lXext -lX11 # Starter Video - - -# The FORMS library, by Mark Overmars, implements user interface -# components such as dialogs and buttons using SGI's GL and FM -# libraries. You must ftp the FORMS library separately from -# ftp://ftp.cs.ruu.nl/pub/SGI/FORMS. It was tested with FORMS 2.2a. -# NOTE: if you want to be able to use FORMS and curses simultaneously -# (or both link them statically into the same binary), you must -# compile all of FORMS with the cc option "-Dclear=__GLclear". - -# The FORMS variable must point to the FORMS subdirectory of the forms -# toplevel directory: - -#FORMS=/ufs/guido/src/forms/FORMS -#fl flmodule.c -I$(FORMS) $(GLHACK) $(FORMS)/libforms.a -lfm -lgl - - # SunOS specific modules -- off by default: #sunaudiodev sunaudiodev.c @@ -409,17 +368,6 @@ GLHACK=-Dclear=__GLclear #DBLIB=$(DB)/lib #_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER) -# Historical Berkeley DB 1.85 -# -# This module is deprecated; the 1.85 version of the Berkeley DB library has -# bugs that can cause data corruption. If you can, use later versions of the -# library instead, available from <http://www.sleepycat.com/>. - -#DB=/depot/sundry/src/berkeley-db/db.1.85 -#DBPORT=$(DB)/PORT/irix.5.3 -#bsddb185 bsddbmodule.c -I$(DBPORT)/include -I$(DBPORT) $(DBPORT)/libdb.a - - # Helper module for various ascii-encoders #binascii binascii.c diff --git a/Modules/almodule.c b/Modules/almodule.c deleted file mode 100644 index 0a45d2e..0000000 --- a/Modules/almodule.c +++ /dev/null @@ -1,3226 +0,0 @@ - -#define OLD_INTERFACE /* define for pre-Irix 6 interface */ - -#include "Python.h" -#include "stringobject.h" -#include <audio.h> -#include <stdarg.h> - -#ifndef AL_NO_ELEM -#ifndef OLD_INTERFACE -#define OLD_INTERFACE -#endif /* OLD_INTERFACE */ -#endif /* AL_NO_ELEM */ - -static PyObject *ErrorObject; - -/* ----------------------------------------------------- */ - -/* Declarations for objects of type port */ - -typedef struct { - PyObject_HEAD - /* XXXX Add your own stuff here */ - ALport port; -} alpobject; - -static PyTypeObject Alptype; - - - -/* ---------------------------------------------------------------- */ - -/* Declarations for objects of type config */ - -typedef struct { - PyObject_HEAD - /* XXXX Add your own stuff here */ - ALconfig config; -} alcobject; - -static PyTypeObject Alctype; - - -static void -ErrorHandler(long code, const char *fmt, ...) -{ - va_list args; - char buf[128]; - - va_start(args, fmt); - vsprintf(buf, fmt, args); - va_end(args); - PyErr_SetString(ErrorObject, buf); -} - -#ifdef AL_NO_ELEM /* IRIX 6 */ - -static PyObject * -param2python(int resource, int param, ALvalue value, ALparamInfo *pinfo) -{ - ALparamInfo info; - - if (pinfo == NULL) { - pinfo = &info; - if (alGetParamInfo(resource, param, &info) < 0) - return NULL; - } - switch (pinfo->elementType) { - case AL_PTR_ELEM: - /* XXXX don't know how to handle this */ - case AL_NO_ELEM: - Py_INCREF(Py_None); - return Py_None; - case AL_INT32_ELEM: - case AL_RESOURCE_ELEM: - case AL_ENUM_ELEM: - return PyInt_FromLong((long) value.i); - case AL_INT64_ELEM: - return PyLong_FromLongLong(value.ll); - case AL_FIXED_ELEM: - return PyFloat_FromDouble(alFixedToDouble(value.ll)); - case AL_CHAR_ELEM: - if (value.ptr == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString((char *) value.ptr); - default: - PyErr_SetString(ErrorObject, "unknown element type"); - return NULL; - } -} - -static int -python2elem(PyObject *item, void *ptr, int elementType) -{ - switch (elementType) { - case AL_INT32_ELEM: - case AL_RESOURCE_ELEM: - case AL_ENUM_ELEM: - if (!PyInt_Check(item)) { - PyErr_BadArgument(); - return -1; - } - *((int *) ptr) = PyInt_AsLong(item); - break; - case AL_INT64_ELEM: - if (PyInt_Check(item)) - *((long long *) ptr) = PyInt_AsLong(item); - else if (PyLong_Check(item)) - *((long long *) ptr) = PyLong_AsLongLong(item); - else { - PyErr_BadArgument(); - return -1; - } - break; - case AL_FIXED_ELEM: - if (PyInt_Check(item)) - *((long long *) ptr) = alDoubleToFixed((double) PyInt_AsLong(item)); - else if (PyFloat_Check(item)) - *((long long *) ptr) = alDoubleToFixed(PyFloat_AsDouble(item)); - else { - PyErr_BadArgument(); - return -1; - } - break; - default: - PyErr_SetString(ErrorObject, "unknown element type"); - return -1; - } - return 0; -} - -static int -python2param(int resource, ALpv *param, PyObject *value, ALparamInfo *pinfo) -{ - ALparamInfo info; - int i, stepsize; - PyObject *item; - - if (pinfo == NULL) { - pinfo = &info; - if (alGetParamInfo(resource, param->param, &info) < 0) - return -1; - } - switch (pinfo->valueType) { - case AL_STRING_VAL: - if (pinfo->elementType != AL_CHAR_ELEM) { - PyErr_SetString(ErrorObject, "unknown element type"); - return -1; - } - if (!PyString_Check(value)) { - PyErr_BadArgument(); - return -1; - } - param->value.ptr = PyString_AS_STRING(value); - param->sizeIn = PyString_GET_SIZE(value)+1; /*account for NUL*/ - break; - case AL_SET_VAL: - case AL_VECTOR_VAL: - if (!PyList_Check(value) && !PyTuple_Check(value)) { - PyErr_BadArgument(); - return -1; - } - switch (pinfo->elementType) { - case AL_INT32_ELEM: - case AL_RESOURCE_ELEM: - case AL_ENUM_ELEM: - param->sizeIn = PySequence_Size(value); - param->value.ptr = PyMem_NEW(int, param->sizeIn); - stepsize = sizeof(int); - break; - case AL_INT64_ELEM: - case AL_FIXED_ELEM: - param->sizeIn = PySequence_Size(value); - param->value.ptr = PyMem_NEW(long long, param->sizeIn); - stepsize = sizeof(long long); - break; - } - for (i = 0; i < param->sizeIn; i++) { - item = PySequence_GetItem(value, i); - if (python2elem(item, (void *) ((char *) param->value.ptr + i*stepsize), pinfo->elementType) < 0) { - PyMem_DEL(param->value.ptr); - return -1; - } - } - break; - case AL_SCALAR_VAL: - switch (pinfo->elementType) { - case AL_INT32_ELEM: - case AL_RESOURCE_ELEM: - case AL_ENUM_ELEM: - return python2elem(value, (void *) ¶m->value.i, - pinfo->elementType); - case AL_INT64_ELEM: - case AL_FIXED_ELEM: - return python2elem(value, (void *) ¶m->value.ll, - pinfo->elementType); - default: - PyErr_SetString(ErrorObject, "unknown element type"); - return -1; - } - } - return 0; -} - -static int -python2params(int resource1, int resource2, PyObject *list, ALpv **pvsp, ALparamInfo **pinfop) -{ - PyObject *item; - ALpv *pvs; - ALparamInfo *pinfo; - int npvs, i; - - npvs = PyList_Size(list); - pvs = PyMem_NEW(ALpv, npvs); - pinfo = PyMem_NEW(ALparamInfo, npvs); - for (i = 0; i < npvs; i++) { - item = PyList_GetItem(list, i); - if (!PyArg_ParseTuple(item, "iO", &pvs[i].param, &item)) - goto error; - if (alGetParamInfo(resource1, pvs[i].param, &pinfo[i]) < 0 && - alGetParamInfo(resource2, pvs[i].param, &pinfo[i]) < 0) - goto error; - if (python2param(resource1, &pvs[i], item, &pinfo[i]) < 0) - goto error; - } - - *pvsp = pvs; - *pinfop = pinfo; - return npvs; - - error: - /* XXXX we should clean up everything */ - if (pvs) - PyMem_DEL(pvs); - if (pinfo) - PyMem_DEL(pinfo); - return -1; -} - -/* -------------------------------------------------------- */ - - -static PyObject * -SetConfig(alcobject *self, PyObject *args, int (*func)(ALconfig, int)) -{ - int par; - - if (!PyArg_ParseTuple(args, "i:SetConfig", &par)) - return NULL; - - if ((*func)(self->config, par) == -1) - return NULL; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -GetConfig(alcobject *self, PyObject *args, int (*func)(ALconfig)) -{ - int par; - - if (!PyArg_ParseTuple(args, ":GetConfig")) - return NULL; - - if ((par = (*func)(self->config)) == -1) - return NULL; - - return PyInt_FromLong((long) par); -} - -PyDoc_STRVAR(alc_SetWidth__doc__, -"alSetWidth: set the wordsize for integer audio data."); - -static PyObject * -alc_SetWidth(alcobject *self, PyObject *args) -{ - return SetConfig(self, args, alSetWidth); -} - - -PyDoc_STRVAR(alc_GetWidth__doc__, -"alGetWidth: get the wordsize for integer audio data."); - -static PyObject * -alc_GetWidth(alcobject *self, PyObject *args) -{ - return GetConfig(self, args, alGetWidth); -} - - -PyDoc_STRVAR(alc_SetSampFmt__doc__, -"alSetSampFmt: set the sample format setting in an audio ALconfig " -"structure."); - -static PyObject * -alc_SetSampFmt(alcobject *self, PyObject *args) -{ - return SetConfig(self, args, alSetSampFmt); -} - - -PyDoc_STRVAR(alc_GetSampFmt__doc__, -"alGetSampFmt: get the sample format setting in an audio ALconfig " -"structure."); - -static PyObject * -alc_GetSampFmt(alcobject *self, PyObject *args) -{ - return GetConfig(self, args, alGetSampFmt); -} - - -PyDoc_STRVAR(alc_SetChannels__doc__, -"alSetChannels: set the channel settings in an audio ALconfig."); - -static PyObject * -alc_SetChannels(alcobject *self, PyObject *args) -{ - return SetConfig(self, args, alSetChannels); -} - - -PyDoc_STRVAR(alc_GetChannels__doc__, -"alGetChannels: get the channel settings in an audio ALconfig."); - -static PyObject * -alc_GetChannels(alcobject *self, PyObject *args) -{ - return GetConfig(self, args, alGetChannels); -} - - -PyDoc_STRVAR(alc_SetFloatMax__doc__, -"alSetFloatMax: set the maximum value of floating point sample data."); - -static PyObject * -alc_SetFloatMax(alcobject *self, PyObject *args) -{ - double maximum_value; - - if (!PyArg_ParseTuple(args, "d:SetFloatMax", &maximum_value)) - return NULL; - if (alSetFloatMax(self->config, maximum_value) < 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - - -PyDoc_STRVAR(alc_GetFloatMax__doc__, -"alGetFloatMax: get the maximum value of floating point sample data."); - -static PyObject * -alc_GetFloatMax(alcobject *self, PyObject *args) -{ - double maximum_value; - - if (!PyArg_ParseTuple(args, ":GetFloatMax")) - return NULL; - if ((maximum_value = alGetFloatMax(self->config)) == 0) - return NULL; - return PyFloat_FromDouble(maximum_value); -} - - -PyDoc_STRVAR(alc_SetDevice__doc__, -"alSetDevice: set the device setting in an audio ALconfig structure."); - -static PyObject * -alc_SetDevice(alcobject *self, PyObject *args) -{ - return SetConfig(self, args, alSetDevice); -} - - -PyDoc_STRVAR(alc_GetDevice__doc__, -"alGetDevice: get the device setting in an audio ALconfig structure."); - -static PyObject * -alc_GetDevice(alcobject *self, PyObject *args) -{ - return GetConfig(self, args, alGetDevice); -} - - -PyDoc_STRVAR(alc_SetQueueSize__doc__, -"alSetQueueSize: set audio port buffer size."); - -static PyObject * -alc_SetQueueSize(alcobject *self, PyObject *args) -{ - return SetConfig(self, args, alSetQueueSize); -} - - -PyDoc_STRVAR(alc_GetQueueSize__doc__, -"alGetQueueSize: get audio port buffer size."); - -static PyObject * -alc_GetQueueSize(alcobject *self, PyObject *args) -{ - return GetConfig(self, args, alGetQueueSize); -} - -#endif /* AL_NO_ELEM */ - -static PyObject * -setconfig(alcobject *self, PyObject *args, int (*func)(ALconfig, long)) -{ - long par; - - if (!PyArg_ParseTuple(args, "l:SetConfig", &par)) - return NULL; - - if ((*func)(self->config, par) == -1) - return NULL; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -getconfig(alcobject *self, PyObject *args, long (*func)(ALconfig)) -{ - long par; - - if (!PyArg_ParseTuple(args, ":GetConfig")) - return NULL; - - if ((par = (*func)(self->config)) == -1) - return NULL; - - return PyInt_FromLong((long) par); -} - -static PyObject * -alc_setqueuesize (alcobject *self, PyObject *args) -{ - return setconfig(self, args, ALsetqueuesize); -} - -static PyObject * -alc_getqueuesize (alcobject *self, PyObject *args) -{ - return getconfig(self, args, ALgetqueuesize); -} - -static PyObject * -alc_setwidth (alcobject *self, PyObject *args) -{ - return setconfig(self, args, ALsetwidth); -} - -static PyObject * -alc_getwidth (alcobject *self, PyObject *args) -{ - return getconfig(self, args, ALgetwidth); -} - -static PyObject * -alc_getchannels (alcobject *self, PyObject *args) -{ - return getconfig(self, args, ALgetchannels); -} - -static PyObject * -alc_setchannels (alcobject *self, PyObject *args) -{ - return setconfig(self, args, ALsetchannels); -} - -#ifdef AL_405 - -static PyObject * -alc_getsampfmt (alcobject *self, PyObject *args) -{ - return getconfig(self, args, ALgetsampfmt); -} - -static PyObject * -alc_setsampfmt (alcobject *self, PyObject *args) -{ - return setconfig(self, args, ALsetsampfmt); -} - -static PyObject * -alc_getfloatmax(alcobject *self, PyObject *args) -{ - double arg; - - if (!PyArg_ParseTuple(args, ":GetFloatMax")) - return 0; - if ((arg = ALgetfloatmax(self->config)) == 0) - return NULL; - return PyFloat_FromDouble(arg); -} - -static PyObject * -alc_setfloatmax(alcobject *self, PyObject *args) -{ - double arg; - - if (!PyArg_ParseTuple(args, "d:SetFloatMax", &arg)) - return 0; - if (ALsetfloatmax(self->config, arg) == -1) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} -#endif /* AL_405 */ - -static struct PyMethodDef alc_methods[] = { -#ifdef AL_NO_ELEM /* IRIX 6 */ - {"SetWidth", (PyCFunction)alc_SetWidth, METH_VARARGS, alc_SetWidth__doc__}, - {"GetWidth", (PyCFunction)alc_GetWidth, METH_VARARGS, alc_GetWidth__doc__}, - {"SetSampFmt", (PyCFunction)alc_SetSampFmt, METH_VARARGS, alc_SetSampFmt__doc__}, - {"GetSampFmt", (PyCFunction)alc_GetSampFmt, METH_VARARGS, alc_GetSampFmt__doc__}, - {"SetChannels", (PyCFunction)alc_SetChannels, METH_VARARGS, alc_SetChannels__doc__}, - {"GetChannels", (PyCFunction)alc_GetChannels, METH_VARARGS, alc_GetChannels__doc__}, - {"SetFloatMax", (PyCFunction)alc_SetFloatMax, METH_VARARGS, alc_SetFloatMax__doc__}, - {"GetFloatMax", (PyCFunction)alc_GetFloatMax, METH_VARARGS, alc_GetFloatMax__doc__}, - {"SetDevice", (PyCFunction)alc_SetDevice, METH_VARARGS, alc_SetDevice__doc__}, - {"GetDevice", (PyCFunction)alc_GetDevice, METH_VARARGS, alc_GetDevice__doc__}, - {"SetQueueSize", (PyCFunction)alc_SetQueueSize, METH_VARARGS, alc_SetQueueSize__doc__}, - {"GetQueueSize", (PyCFunction)alc_GetQueueSize, METH_VARARGS, alc_GetQueueSize__doc__}, -#endif /* AL_NO_ELEM */ - {"getqueuesize", (PyCFunction)alc_getqueuesize, METH_VARARGS}, - {"setqueuesize", (PyCFunction)alc_setqueuesize, METH_VARARGS}, - {"getwidth", (PyCFunction)alc_getwidth, METH_VARARGS}, - {"setwidth", (PyCFunction)alc_setwidth, METH_VARARGS}, - {"getchannels", (PyCFunction)alc_getchannels, METH_VARARGS}, - {"setchannels", (PyCFunction)alc_setchannels, METH_VARARGS}, -#ifdef AL_405 - {"getsampfmt", (PyCFunction)alc_getsampfmt, METH_VARARGS}, - {"setsampfmt", (PyCFunction)alc_setsampfmt, METH_VARARGS}, - {"getfloatmax", (PyCFunction)alc_getfloatmax, METH_VARARGS}, - {"setfloatmax", (PyCFunction)alc_setfloatmax, METH_VARARGS}, -#endif /* AL_405 */ - - {NULL, NULL} /* sentinel */ -}; - -/* ---------- */ - - -static PyObject * -newalcobject(ALconfig config) -{ - alcobject *self; - - self = PyObject_New(alcobject, &Alctype); - if (self == NULL) - return NULL; - /* XXXX Add your own initializers here */ - self->config = config; - return (PyObject *) self; -} - - -static void -alc_dealloc(alcobject *self) -{ - /* XXXX Add your own cleanup code here */ -#ifdef AL_NO_ELEM /* IRIX 6 */ - (void) alFreeConfig(self->config); /* ignore errors */ -#else - (void) ALfreeconfig(self->config); /* ignore errors */ -#endif - PyObject_Del(self); -} - -static PyObject * -alc_getattr(alcobject *self, char *name) -{ - /* XXXX Add your own getattr code here */ - return Py_FindMethod(alc_methods, (PyObject *)self, name); -} - -PyDoc_STRVAR(Alctype__doc__, ""); - -static PyTypeObject Alctype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "al.config", /*tp_name*/ - sizeof(alcobject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)alc_dealloc, /*tp_dealloc*/ - (printfunc)0, /*tp_print*/ - (getattrfunc)alc_getattr, /*tp_getattr*/ - (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ - (reprfunc)0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - (hashfunc)0, /*tp_hash*/ - (ternaryfunc)0, /*tp_call*/ - (reprfunc)0, /*tp_str*/ - - /* Space for future expansion */ - 0L,0L,0L,0L, - Alctype__doc__ /* Documentation string */ -}; - -/* End of code for config objects */ -/* ---------------------------------------------------------------- */ - -#ifdef AL_NO_ELEM /* IRIX 6 */ - -PyDoc_STRVAR(alp_SetConfig__doc__, -"alSetConfig: set the ALconfig of an audio ALport."); - -static PyObject * -alp_SetConfig(alpobject *self, PyObject *args) -{ - alcobject *config; - if (!PyArg_ParseTuple(args, "O!:SetConfig", &Alctype, &config)) - return NULL; - if (alSetConfig(self->port, config->config) < 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - - -PyDoc_STRVAR(alp_GetConfig__doc__, -"alGetConfig: get the ALconfig of an audio ALport."); - -static PyObject * -alp_GetConfig(alpobject *self, PyObject *args) -{ - ALconfig config; - if (!PyArg_ParseTuple(args, ":GetConfig")) - return NULL; - if ((config = alGetConfig(self->port)) == NULL) - return NULL; - return newalcobject(config); -} - - -PyDoc_STRVAR(alp_GetResource__doc__, -"alGetResource: get the resource associated with an audio port."); - -static PyObject * -alp_GetResource(alpobject *self, PyObject *args) -{ - int resource; - - if (!PyArg_ParseTuple(args, ":GetResource")) - return NULL; - if ((resource = alGetResource(self->port)) == 0) - return NULL; - return PyInt_FromLong((long) resource); -} - - -PyDoc_STRVAR(alp_GetFD__doc__, -"alGetFD: get the file descriptor for an audio port."); - -static PyObject * -alp_GetFD(alpobject *self, PyObject *args) -{ - int fd; - - if (!PyArg_ParseTuple(args, ":GetFD")) - return NULL; - - if ((fd = alGetFD(self->port)) < 0) - return NULL; - - return PyInt_FromLong((long) fd); -} - - -PyDoc_STRVAR(alp_GetFilled__doc__, -"alGetFilled: return the number of filled sample frames in " -"an audio port."); - -static PyObject * -alp_GetFilled(alpobject *self, PyObject *args) -{ - int filled; - - if (!PyArg_ParseTuple(args, ":GetFilled")) - return NULL; - if ((filled = alGetFilled(self->port)) < 0) - return NULL; - return PyInt_FromLong((long) filled); -} - - -PyDoc_STRVAR(alp_GetFillable__doc__, -"alGetFillable: report the number of unfilled sample frames " -"in an audio port."); - -static PyObject * -alp_GetFillable(alpobject *self, PyObject *args) -{ - int fillable; - - if (!PyArg_ParseTuple(args, ":GetFillable")) - return NULL; - if ((fillable = alGetFillable(self->port)) < 0) - return NULL; - return PyInt_FromLong((long) fillable); -} - - -PyDoc_STRVAR(alp_ReadFrames__doc__, -"alReadFrames: read sample frames from an audio port."); - -static PyObject * -alp_ReadFrames(alpobject *self, PyObject *args) -{ - int framecount; - PyObject *v; - int size; - int ch; - ALconfig c; - - if (!PyArg_ParseTuple(args, "i:ReadFrames", &framecount)) - return NULL; - if (framecount < 0) { - PyErr_SetString(ErrorObject, "negative framecount"); - return NULL; - } - c = alGetConfig(self->port); - switch (alGetSampFmt(c)) { - case AL_SAMPFMT_TWOSCOMP: - switch (alGetWidth(c)) { - case AL_SAMPLE_8: - size = 1; - break; - case AL_SAMPLE_16: - size = 2; - break; - case AL_SAMPLE_24: - size = 4; - break; - default: - PyErr_SetString(ErrorObject, "can't determine width"); - alFreeConfig(c); - return NULL; - } - break; - case AL_SAMPFMT_FLOAT: - size = 4; - break; - case AL_SAMPFMT_DOUBLE: - size = 8; - break; - default: - PyErr_SetString(ErrorObject, "can't determine format"); - alFreeConfig(c); - return NULL; - } - ch = alGetChannels(c); - alFreeConfig(c); - if (ch < 0) { - PyErr_SetString(ErrorObject, "can't determine # of channels"); - return NULL; - } - size *= ch; - v = PyString_FromStringAndSize((char *) NULL, size * framecount); - if (v == NULL) - return NULL; - - Py_BEGIN_ALLOW_THREADS - alReadFrames(self->port, (void *) PyString_AS_STRING(v), framecount); - Py_END_ALLOW_THREADS - - return v; -} - - -PyDoc_STRVAR(alp_DiscardFrames__doc__, -"alDiscardFrames: discard audio from an audio port."); - -static PyObject * -alp_DiscardFrames(alpobject *self, PyObject *args) -{ - int framecount; - - if (!PyArg_ParseTuple(args, "i:DiscardFrames", &framecount)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - framecount = alDiscardFrames(self->port, framecount); - Py_END_ALLOW_THREADS - - if (framecount < 0) - return NULL; - - return PyInt_FromLong((long) framecount); -} - - -PyDoc_STRVAR(alp_ZeroFrames__doc__, -"alZeroFrames: write zero-valued sample frames to an audio port."); - -static PyObject * -alp_ZeroFrames(alpobject *self, PyObject *args) -{ - int framecount; - - if (!PyArg_ParseTuple(args, "i:ZeroFrames", &framecount)) - return NULL; - - if (framecount < 0) { - PyErr_SetString(ErrorObject, "negative framecount"); - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - alZeroFrames(self->port, framecount); - Py_END_ALLOW_THREADS - - Py_INCREF(Py_None); - return Py_None; -} - - -PyDoc_STRVAR(alp_SetFillPoint__doc__, -"alSetFillPoint: set low- or high-water mark for an audio port."); - -static PyObject * -alp_SetFillPoint(alpobject *self, PyObject *args) -{ - int fillpoint; - - if (!PyArg_ParseTuple(args, "i:SetFillPoint", &fillpoint)) - return NULL; - - if (alSetFillPoint(self->port, fillpoint) < 0) - return NULL; - - Py_INCREF(Py_None); - return Py_None; -} - - -PyDoc_STRVAR(alp_GetFillPoint__doc__, -"alGetFillPoint: get low- or high-water mark for an audio port."); - -static PyObject * -alp_GetFillPoint(alpobject *self, PyObject *args) -{ - int fillpoint; - - if (!PyArg_ParseTuple(args, ":GetFillPoint")) - return NULL; - - if ((fillpoint = alGetFillPoint(self->port)) < 0) - return NULL; - - return PyInt_FromLong((long) fillpoint); -} - - -PyDoc_STRVAR(alp_GetFrameNumber__doc__, -"alGetFrameNumber: get the absolute sample frame number " -"associated with a port."); - -static PyObject * -alp_GetFrameNumber(alpobject *self, PyObject *args) -{ - stamp_t fnum; - - if (!PyArg_ParseTuple(args, ":GetFrameNumber")) - return NULL; - - if (alGetFrameNumber(self->port, &fnum) < 0) - return NULL; - - return PyLong_FromLongLong((long long) fnum); -} - - -PyDoc_STRVAR(alp_GetFrameTime__doc__, -"alGetFrameTime: get the time at which a sample frame came " -"in or will go out."); - -static PyObject * -alp_GetFrameTime(alpobject *self, PyObject *args) -{ - stamp_t fnum, time; - PyObject *ret, *v0, *v1; - - if (!PyArg_ParseTuple(args, ":GetFrameTime")) - return NULL; - if (alGetFrameTime(self->port, &fnum, &time) < 0) - return NULL; - v0 = PyLong_FromLongLong((long long) fnum); - v1 = PyLong_FromLongLong((long long) time); - if (PyErr_Occurred()) { - Py_XDECREF(v0); - Py_XDECREF(v1); - return NULL; - } - ret = PyTuple_Pack(2, v0, v1); - Py_DECREF(v0); - Py_DECREF(v1); - return ret; -} - - -PyDoc_STRVAR(alp_WriteFrames__doc__, -"alWriteFrames: write sample frames to an audio port."); - -static PyObject * -alp_WriteFrames(alpobject *self, PyObject *args) -{ - char *samples; - int length; - int size, ch; - ALconfig c; - - if (!PyArg_ParseTuple(args, "s#:WriteFrames", &samples, &length)) - return NULL; - c = alGetConfig(self->port); - switch (alGetSampFmt(c)) { - case AL_SAMPFMT_TWOSCOMP: - switch (alGetWidth(c)) { - case AL_SAMPLE_8: - size = 1; - break; - case AL_SAMPLE_16: - size = 2; - break; - case AL_SAMPLE_24: - size = 4; - break; - default: - PyErr_SetString(ErrorObject, "can't determine width"); - alFreeConfig(c); - return NULL; - } - break; - case AL_SAMPFMT_FLOAT: - size = 4; - break; - case AL_SAMPFMT_DOUBLE: - size = 8; - break; - default: - PyErr_SetString(ErrorObject, "can't determine format"); - alFreeConfig(c); - return NULL; - } - ch = alGetChannels(c); - alFreeConfig(c); - if (ch < 0) { - PyErr_SetString(ErrorObject, "can't determine # of channels"); - return NULL; - } - size *= ch; - if (length % size != 0) { - PyErr_SetString(ErrorObject, - "buffer length not whole number of frames"); - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - alWriteFrames(self->port, (void *) samples, length / size); - Py_END_ALLOW_THREADS - - Py_INCREF(Py_None); - return Py_None; -} - - -PyDoc_STRVAR(alp_ClosePort__doc__, "alClosePort: close an audio port."); - -static PyObject * -alp_ClosePort(alpobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":ClosePort")) - return NULL; - if (alClosePort(self->port) < 0) - return NULL; - self->port = NULL; - Py_INCREF(Py_None); - return Py_None; -} - -#endif /* AL_NO_ELEM */ - -#ifdef OLD_INTERFACE -static PyObject * -alp_closeport(alpobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":ClosePort")) - return NULL; - if (ALcloseport(self->port) < 0) - return NULL; - self->port = NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -alp_getfd(alpobject *self, PyObject *args) -{ - int fd; - - if (!PyArg_ParseTuple(args, ":GetFD")) - return NULL; - if ((fd = ALgetfd(self-> port)) == -1) - return NULL; - return PyInt_FromLong(fd); -} - -static PyObject * -alp_getfilled(alpobject *self, PyObject *args) -{ - long count; - - if (!PyArg_ParseTuple(args, ":GetFilled")) - return NULL; - if ((count = ALgetfilled(self-> port)) == -1) - return NULL; - return PyInt_FromLong(count); -} - -static PyObject * -alp_getfillable(alpobject *self, PyObject *args) -{ - long count; - - if (!PyArg_ParseTuple(args, ":GetFillable")) - return NULL; - if ((count = ALgetfillable(self-> port)) == -1) - return NULL; - return PyInt_FromLong (count); -} - -static PyObject * -alp_readsamps(alpobject *self, PyObject *args) -{ - long count; - PyObject *v; - ALconfig c; - int width; - int ret; - - if (!PyArg_ParseTuple(args, "l:readsamps", &count)) - return NULL; - - if (count <= 0) { - PyErr_SetString(ErrorObject, "al.readsamps : arg <= 0"); - return NULL; - } - - c = ALgetconfig(self->port); -#ifdef AL_405 - width = ALgetsampfmt(c); - if (width == AL_SAMPFMT_FLOAT) - width = sizeof(float); - else if (width == AL_SAMPFMT_DOUBLE) - width = sizeof(double); - else - width = ALgetwidth(c); -#else - width = ALgetwidth(c); -#endif /* AL_405 */ - ALfreeconfig(c); - v = PyString_FromStringAndSize((char *)NULL, width * count); - if (v == NULL) - return NULL; - - Py_BEGIN_ALLOW_THREADS - ret = ALreadsamps(self->port, (void *) PyString_AsString(v), count); - Py_END_ALLOW_THREADS - if (ret == -1) { - Py_DECREF(v); - return NULL; - } - - return (v); -} - -static PyObject * -alp_writesamps(alpobject *self, PyObject *args) -{ - char *buf; - int size, width; - ALconfig c; - int ret; - - if (!PyArg_ParseTuple(args, "s#:writesamps", &buf, &size)) - return NULL; - - c = ALgetconfig(self->port); -#ifdef AL_405 - width = ALgetsampfmt(c); - if (width == AL_SAMPFMT_FLOAT) - width = sizeof(float); - else if (width == AL_SAMPFMT_DOUBLE) - width = sizeof(double); - else - width = ALgetwidth(c); -#else - width = ALgetwidth(c); -#endif /* AL_405 */ - ALfreeconfig(c); - Py_BEGIN_ALLOW_THREADS - ret = ALwritesamps (self->port, (void *) buf, (long) size / width); - Py_END_ALLOW_THREADS - if (ret == -1) - return NULL; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -alp_getfillpoint(alpobject *self, PyObject *args) -{ - long count; - - if (!PyArg_ParseTuple(args, ":GetFillPoint")) - return NULL; - if ((count = ALgetfillpoint(self->port)) == -1) - return NULL; - return PyInt_FromLong(count); -} - -static PyObject * -alp_setfillpoint(alpobject *self, PyObject *args) -{ - long count; - - if (!PyArg_ParseTuple(args, "l:SetFillPoint", &count)) - return NULL; - if (ALsetfillpoint(self->port, count) == -1) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -alp_setconfig(alpobject *self, PyObject *args) -{ - alcobject *config; - - if (!PyArg_ParseTuple(args, "O!:SetConfig", &Alctype, &config)) - return NULL; - if (ALsetconfig(self->port, config->config) == -1) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -alp_getconfig(alpobject *self, PyObject *args) -{ - ALconfig config; - - if (!PyArg_ParseTuple(args, ":GetConfig")) - return NULL; - config = ALgetconfig(self->port); - if (config == NULL) - return NULL; - return newalcobject(config); -} - -#ifdef AL_405 -static PyObject * -alp_getstatus(alpobject *self, PyObject *args) -{ - PyObject *list, *v; - long *PVbuffer; - long length; - int i; - - if (!PyArg_ParseTuple(args, "O!", &PyList_Type, &list)) - return NULL; - length = PyList_Size(list); - PVbuffer = PyMem_NEW(long, length); - if (PVbuffer == NULL) - return PyErr_NoMemory(); - for (i = 0; i < length; i++) { - v = PyList_GetItem(list, i); - if (!PyInt_Check(v)) { - PyMem_DEL(PVbuffer); - PyErr_BadArgument(); - return NULL; - } - PVbuffer[i] = PyInt_AsLong(v); - } - - if (ALgetstatus(self->port, PVbuffer, length) == -1) - return NULL; - - for (i = 0; i < length; i++) - PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i])); - - PyMem_DEL(PVbuffer); - - Py_INCREF(Py_None); - return Py_None; -} -#endif /* AL_405 */ - -#endif /* OLD_INTERFACE */ - -static struct PyMethodDef alp_methods[] = { -#ifdef AL_NO_ELEM /* IRIX 6 */ - {"SetConfig", (PyCFunction)alp_SetConfig, METH_VARARGS, alp_SetConfig__doc__}, - {"GetConfig", (PyCFunction)alp_GetConfig, METH_VARARGS, alp_GetConfig__doc__}, - {"GetResource", (PyCFunction)alp_GetResource, METH_VARARGS, alp_GetResource__doc__}, - {"GetFD", (PyCFunction)alp_GetFD, METH_VARARGS, alp_GetFD__doc__}, - {"GetFilled", (PyCFunction)alp_GetFilled, METH_VARARGS, alp_GetFilled__doc__}, - {"GetFillable", (PyCFunction)alp_GetFillable, METH_VARARGS, alp_GetFillable__doc__}, - {"ReadFrames", (PyCFunction)alp_ReadFrames, METH_VARARGS, alp_ReadFrames__doc__}, - {"DiscardFrames", (PyCFunction)alp_DiscardFrames, METH_VARARGS, alp_DiscardFrames__doc__}, - {"ZeroFrames", (PyCFunction)alp_ZeroFrames, METH_VARARGS, alp_ZeroFrames__doc__}, - {"SetFillPoint", (PyCFunction)alp_SetFillPoint, METH_VARARGS, alp_SetFillPoint__doc__}, - {"GetFillPoint", (PyCFunction)alp_GetFillPoint, METH_VARARGS, alp_GetFillPoint__doc__}, - {"GetFrameNumber", (PyCFunction)alp_GetFrameNumber, METH_VARARGS, alp_GetFrameNumber__doc__}, - {"GetFrameTime", (PyCFunction)alp_GetFrameTime, METH_VARARGS, alp_GetFrameTime__doc__}, - {"WriteFrames", (PyCFunction)alp_WriteFrames, METH_VARARGS, alp_WriteFrames__doc__}, - {"ClosePort", (PyCFunction)alp_ClosePort, METH_VARARGS, alp_ClosePort__doc__}, -#endif /* AL_NO_ELEM */ -#ifdef OLD_INTERFACE - {"closeport", (PyCFunction)alp_closeport, METH_VARARGS}, - {"getfd", (PyCFunction)alp_getfd, METH_VARARGS}, - {"fileno", (PyCFunction)alp_getfd, METH_VARARGS}, - {"getfilled", (PyCFunction)alp_getfilled, METH_VARARGS}, - {"getfillable", (PyCFunction)alp_getfillable, METH_VARARGS}, - {"readsamps", (PyCFunction)alp_readsamps, METH_VARARGS}, - {"writesamps", (PyCFunction)alp_writesamps, METH_VARARGS}, - {"setfillpoint", (PyCFunction)alp_setfillpoint, METH_VARARGS}, - {"getfillpoint", (PyCFunction)alp_getfillpoint, METH_VARARGS}, - {"setconfig", (PyCFunction)alp_setconfig, METH_VARARGS}, - {"getconfig", (PyCFunction)alp_getconfig, METH_VARARGS}, -#ifdef AL_405 - {"getstatus", (PyCFunction)alp_getstatus, METH_VARARGS}, -#endif /* AL_405 */ -#endif /* OLD_INTERFACE */ - - {NULL, NULL} /* sentinel */ -}; - -/* ---------- */ - - -static PyObject * -newalpobject(ALport port) -{ - alpobject *self; - - self = PyObject_New(alpobject, &Alptype); - if (self == NULL) - return NULL; - /* XXXX Add your own initializers here */ - self->port = port; - return (PyObject *) self; -} - - -static void -alp_dealloc(alpobject *self) -{ - /* XXXX Add your own cleanup code here */ - if (self->port) { -#ifdef AL_NO_ELEM /* IRIX 6 */ - alClosePort(self->port); -#else - ALcloseport(self->port); -#endif - } - PyObject_Del(self); -} - -static PyObject * -alp_getattr(alpobject *self, char *name) -{ - /* XXXX Add your own getattr code here */ - if (self->port == NULL) { - PyErr_SetString(ErrorObject, "port already closed"); - return NULL; - } - return Py_FindMethod(alp_methods, (PyObject *)self, name); -} - -PyDoc_STRVAR(Alptype__doc__, ""); - -static PyTypeObject Alptype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "al.port", /*tp_name*/ - sizeof(alpobject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)alp_dealloc, /*tp_dealloc*/ - (printfunc)0, /*tp_print*/ - (getattrfunc)alp_getattr, /*tp_getattr*/ - (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ - (reprfunc)0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - (hashfunc)0, /*tp_hash*/ - (ternaryfunc)0, /*tp_call*/ - (reprfunc)0, /*tp_str*/ - - /* Space for future expansion */ - 0L,0L,0L,0L, - Alptype__doc__ /* Documentation string */ -}; - -/* End of code for port objects */ -/* -------------------------------------------------------- */ - - -#ifdef AL_NO_ELEM /* IRIX 6 */ - -PyDoc_STRVAR(al_NewConfig__doc__, -"alNewConfig: create and initialize an audio ALconfig structure."); - -static PyObject * -al_NewConfig(PyObject *self, PyObject *args) -{ - ALconfig config; - - if (!PyArg_ParseTuple(args, ":NewConfig")) - return NULL; - if ((config = alNewConfig()) == NULL) - return NULL; - return newalcobject(config); -} - -PyDoc_STRVAR(al_OpenPort__doc__, -"alOpenPort: open an audio port."); - -static PyObject * -al_OpenPort(PyObject *self, PyObject *args) -{ - ALport port; - char *name, *dir; - alcobject *config = NULL; - - if (!PyArg_ParseTuple(args, "ss|O!:OpenPort", &name, &dir, &Alctype, &config)) - return NULL; - if ((port = alOpenPort(name, dir, config ? config->config : NULL)) == NULL) - return NULL; - return newalpobject(port); -} - -PyDoc_STRVAR(al_Connect__doc__, -"alConnect: connect two audio I/O resources."); - -static PyObject * -al_Connect(PyObject *self, PyObject *args) -{ - int source, dest, nprops = 0, id, i; - ALpv *props = NULL; - ALparamInfo *propinfo = NULL; - PyObject *propobj = NULL; - - if (!PyArg_ParseTuple(args, "ii|O!:Connect", &source, &dest, &PyList_Type, &propobj)) - return NULL; - if (propobj != NULL) { - nprops = python2params(source, dest, propobj, &props, &propinfo); - if (nprops < 0) - return NULL; - } - - id = alConnect(source, dest, props, nprops); - - if (props) { - for (i = 0; i < nprops; i++) { - switch (propinfo[i].valueType) { - case AL_SET_VAL: - case AL_VECTOR_VAL: - PyMem_DEL(props[i].value.ptr); - break; - } - } - PyMem_DEL(props); - PyMem_DEL(propinfo); - } - - if (id < 0) - return NULL; - return PyInt_FromLong((long) id); -} - -PyDoc_STRVAR(al_Disconnect__doc__, -"alDisconnect: delete a connection between two audio I/O resources."); - -static PyObject * -al_Disconnect(PyObject *self, PyObject *args) -{ - int res; - - if (!PyArg_ParseTuple(args, "i:Disconnect", &res)) - return NULL; - if (alDisconnect(res) < 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(al_GetParams__doc__, -"alGetParams: get the values of audio resource parameters."); - -static PyObject * -al_GetParams(PyObject *self, PyObject *args) -{ - int resource; - PyObject *pvslist, *item = NULL, *v = NULL; - ALpv *pvs; - int i, j, npvs; - ALparamInfo *pinfo; - - if (!PyArg_ParseTuple(args, "iO!:GetParams", &resource, &PyList_Type, &pvslist)) - return NULL; - npvs = PyList_Size(pvslist); - pvs = PyMem_NEW(ALpv, npvs); - pinfo = PyMem_NEW(ALparamInfo, npvs); - for (i = 0; i < npvs; i++) { - item = PyList_GetItem(pvslist, i); - if (!PyInt_Check(item)) { - item = NULL; - PyErr_SetString(ErrorObject, "list of integers expected"); - goto error; - } - pvs[i].param = (int) PyInt_AsLong(item); - item = NULL; /* not needed anymore */ - if (alGetParamInfo(resource, pvs[i].param, &pinfo[i]) < 0) - goto error; - switch (pinfo[i].valueType) { - case AL_NO_VAL: - break; - case AL_MATRIX_VAL: - pinfo[i].maxElems *= pinfo[i].maxElems2; - /* fall through */ - case AL_STRING_VAL: - case AL_SET_VAL: - case AL_VECTOR_VAL: - switch (pinfo[i].elementType) { - case AL_INT32_ELEM: - case AL_RESOURCE_ELEM: - case AL_ENUM_ELEM: - pvs[i].value.ptr = PyMem_NEW(int, pinfo[i].maxElems); - pvs[i].sizeIn = pinfo[i].maxElems; - break; - case AL_INT64_ELEM: - case AL_FIXED_ELEM: - pvs[i].value.ptr = PyMem_NEW(long long, pinfo[i].maxElems); - pvs[i].sizeIn = pinfo[i].maxElems; - break; - case AL_CHAR_ELEM: - pvs[i].value.ptr = PyMem_NEW(char, 32); - pvs[i].sizeIn = 32; - break; - case AL_NO_ELEM: - case AL_PTR_ELEM: - default: - PyErr_SetString(ErrorObject, "internal error"); - goto error; - } - break; - case AL_SCALAR_VAL: - break; - default: - PyErr_SetString(ErrorObject, "internal error"); - goto error; - } - if (pinfo[i].valueType == AL_MATRIX_VAL) { - pinfo[i].maxElems /= pinfo[i].maxElems2; - pvs[i].sizeIn /= pinfo[i].maxElems2; - pvs[i].size2In = pinfo[i].maxElems2; - } - } - if (alGetParams(resource, pvs, npvs) < 0) - goto error; - if (!(v = PyList_New(npvs))) - goto error; - for (i = 0; i < npvs; i++) { - if (pvs[i].sizeOut < 0) { - char buf[32]; - PyOS_snprintf(buf, sizeof(buf), - "problem with param %d", i); - PyErr_SetString(ErrorObject, buf); - goto error; - } - switch (pinfo[i].valueType) { - case AL_NO_VAL: - item = Py_None; - Py_INCREF(item); - break; - case AL_STRING_VAL: - item = PyString_FromString(pvs[i].value.ptr); - PyMem_DEL(pvs[i].value.ptr); - break; - case AL_MATRIX_VAL: - /* XXXX this is not right */ - pvs[i].sizeOut *= pvs[i].size2Out; - /* fall through */ - case AL_SET_VAL: - case AL_VECTOR_VAL: - item = PyList_New(pvs[i].sizeOut); - for (j = 0; j < pvs[i].sizeOut; j++) { - switch (pinfo[i].elementType) { - case AL_INT32_ELEM: - case AL_RESOURCE_ELEM: - case AL_ENUM_ELEM: - PyList_SetItem(item, j, PyInt_FromLong((long) ((int *) pvs[i].value.ptr)[j])); - break; - case AL_INT64_ELEM: - PyList_SetItem(item, j, PyLong_FromLongLong(((long long *) pvs[i].value.ptr)[j])); - break; - case AL_FIXED_ELEM: - PyList_SetItem(item, j, PyFloat_FromDouble(alFixedToDouble(((long long *) pvs[i].value.ptr)[j]))); - break; - default: - PyErr_SetString(ErrorObject, "internal error"); - goto error; - } - } - PyMem_DEL(pvs[i].value.ptr); - break; - case AL_SCALAR_VAL: - item = param2python(resource, pvs[i].param, pvs[i].value, &pinfo[i]); - break; - } - if (PyErr_Occurred() || - PyList_SetItem(v, i, Py_BuildValue("(iO)", pvs[i].param, - item)) < 0 || - PyErr_Occurred()) - goto error; - Py_DECREF(item); - } - PyMem_DEL(pvs); - PyMem_DEL(pinfo); - return v; - - error: - Py_XDECREF(v); - Py_XDECREF(item); - if (pvs) - PyMem_DEL(pvs); - if (pinfo) - PyMem_DEL(pinfo); - return NULL; -} - -PyDoc_STRVAR(al_SetParams__doc__, -"alSetParams: set the values of audio resource parameters."); - -static PyObject * -al_SetParams(PyObject *self, PyObject *args) -{ - int resource; - PyObject *pvslist; - ALpv *pvs; - ALparamInfo *pinfo; - int npvs, i; - - if (!PyArg_ParseTuple(args, "iO!:SetParams", &resource, &PyList_Type, &pvslist)) - return NULL; - npvs = python2params(resource, -1, pvslist, &pvs, &pinfo); - if (npvs < 0) - return NULL; - - if (alSetParams(resource, pvs, npvs) < 0) - goto error; - - /* cleanup */ - for (i = 0; i < npvs; i++) { - switch (pinfo[i].valueType) { - case AL_SET_VAL: - case AL_VECTOR_VAL: - PyMem_DEL(pvs[i].value.ptr); - break; - } - } - PyMem_DEL(pvs); - PyMem_DEL(pinfo); - - Py_INCREF(Py_None); - return Py_None; - - error: - /* XXXX we should clean up everything */ - if (pvs) - PyMem_DEL(pvs); - if (pinfo) - PyMem_DEL(pinfo); - return NULL; -} - -PyDoc_STRVAR(al_QueryValues__doc__, -"alQueryValues: get the set of possible values for a parameter."); - -static PyObject * -al_QueryValues(PyObject *self, PyObject *args) -{ - int resource, param; - ALvalue *return_set = NULL; - int setsize = 32, qualsize = 0, nvals, i; - ALpv *quals = NULL; - ALparamInfo pinfo; - ALparamInfo *qualinfo = NULL; - PyObject *qualobj = NULL; - PyObject *res = NULL, *item; - - if (!PyArg_ParseTuple(args, "ii|O!:QueryValues", &resource, ¶m, - &PyList_Type, &qualobj)) - return NULL; - if (qualobj != NULL) { - qualsize = python2params(resource, param, qualobj, &quals, &qualinfo); - if (qualsize < 0) - return NULL; - } - setsize = 32; - return_set = PyMem_NEW(ALvalue, setsize); - if (return_set == NULL) { - PyErr_NoMemory(); - goto cleanup; - } - - retry: - nvals = alQueryValues(resource, param, return_set, setsize, quals, qualsize); - if (nvals < 0) - goto cleanup; - if (nvals > setsize) { - setsize = nvals; - PyMem_RESIZE(return_set, ALvalue, setsize); - if (return_set == NULL) { - PyErr_NoMemory(); - goto cleanup; - } - goto retry; - } - - if (alGetParamInfo(resource, param, &pinfo) < 0) - goto cleanup; - - res = PyList_New(nvals); - if (res == NULL) - goto cleanup; - for (i = 0; i < nvals; i++) { - item = param2python(resource, param, return_set[i], &pinfo); - if (item == NULL || - PyList_SetItem(res, i, item) < 0) { - Py_DECREF(res); - res = NULL; - goto cleanup; - } - } - - cleanup: - if (return_set) - PyMem_DEL(return_set); - if (quals) { - for (i = 0; i < qualsize; i++) { - switch (qualinfo[i].valueType) { - case AL_SET_VAL: - case AL_VECTOR_VAL: - PyMem_DEL(quals[i].value.ptr); - break; - } - } - PyMem_DEL(quals); - PyMem_DEL(qualinfo); - } - - return res; -} - -PyDoc_STRVAR(al_GetParamInfo__doc__, -"alGetParamInfo: get information about a parameter on " -"a particular audio resource."); - -static PyObject * -al_GetParamInfo(PyObject *self, PyObject *args) -{ - int res, param; - ALparamInfo pinfo; - PyObject *v, *item; - - if (!PyArg_ParseTuple(args, "ii:GetParamInfo", &res, ¶m)) - return NULL; - if (alGetParamInfo(res, param, &pinfo) < 0) - return NULL; - v = PyDict_New(); - if (!v) return NULL; - - item = PyInt_FromLong((long) pinfo.resource); - PyDict_SetItemString(v, "resource", item); - Py_DECREF(item); - - item = PyInt_FromLong((long) pinfo.param); - PyDict_SetItemString(v, "param", item); - Py_DECREF(item); - - item = PyInt_FromLong((long) pinfo.valueType); - PyDict_SetItemString(v, "valueType", item); - Py_DECREF(item); - - if (pinfo.valueType != AL_NO_VAL && pinfo.valueType != AL_SCALAR_VAL) { - /* multiple values */ - item = PyInt_FromLong((long) pinfo.maxElems); - PyDict_SetItemString(v, "maxElems", item); - Py_DECREF(item); - - if (pinfo.valueType == AL_MATRIX_VAL) { - /* 2 dimensional */ - item = PyInt_FromLong((long) pinfo.maxElems2); - PyDict_SetItemString(v, "maxElems2", item); - Py_DECREF(item); - } - } - - item = PyInt_FromLong((long) pinfo.elementType); - PyDict_SetItemString(v, "elementType", item); - Py_DECREF(item); - - item = PyString_FromString(pinfo.name); - PyDict_SetItemString(v, "name", item); - Py_DECREF(item); - - item = param2python(res, param, pinfo.initial, &pinfo); - PyDict_SetItemString(v, "initial", item); - Py_DECREF(item); - - if (pinfo.elementType != AL_ENUM_ELEM && - pinfo.elementType != AL_RESOURCE_ELEM && - pinfo.elementType != AL_CHAR_ELEM) { - /* range param */ - item = param2python(res, param, pinfo.min, &pinfo); - PyDict_SetItemString(v, "min", item); - Py_DECREF(item); - - item = param2python(res, param, pinfo.max, &pinfo); - PyDict_SetItemString(v, "max", item); - Py_DECREF(item); - - item = param2python(res, param, pinfo.minDelta, &pinfo); - PyDict_SetItemString(v, "minDelta", item); - Py_DECREF(item); - - item = param2python(res, param, pinfo.maxDelta, &pinfo); - PyDict_SetItemString(v, "maxDelta", item); - Py_DECREF(item); - - item = PyInt_FromLong((long) pinfo.specialVals); - PyDict_SetItemString(v, "specialVals", item); - Py_DECREF(item); - } - - return v; -} - -PyDoc_STRVAR(al_GetResourceByName__doc__, -"alGetResourceByName: find an audio resource by name."); - -static PyObject * -al_GetResourceByName(PyObject *self, PyObject *args) -{ - int res, start_res, type; - char *name; - - if (!PyArg_ParseTuple(args, "isi:GetResourceByName", &start_res, &name, &type)) - return NULL; - if ((res = alGetResourceByName(start_res, name, type)) == 0) - return NULL; - return PyInt_FromLong((long) res); -} - -PyDoc_STRVAR(al_IsSubtype__doc__, -"alIsSubtype: indicate if one resource type is a subtype of another."); - -static PyObject * -al_IsSubtype(PyObject *self, PyObject *args) -{ - int type, subtype; - - if (!PyArg_ParseTuple(args, "ii:IsSubtype", &type, &subtype)) - return NULL; - return PyInt_FromLong((long) alIsSubtype(type, subtype)); -} - -PyDoc_STRVAR(al_SetErrorHandler__doc__, ""); - -static PyObject * -al_SetErrorHandler(PyObject *self, PyObject *args) -{ - - if (!PyArg_ParseTuple(args, ":SetErrorHandler")) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -#endif /* AL_NO_ELEM */ - -#ifdef OLD_INTERFACE - -static PyObject * -al_openport(PyObject *self, PyObject *args) -{ - char *name, *dir; - ALport port; - alcobject *config = NULL; - - if (!PyArg_ParseTuple(args, "ss|O!:OpenPort", &name, &dir, &Alctype, &config)) - return NULL; - if ((port = ALopenport(name, dir, config ? config->config : NULL)) == NULL) - return NULL; - return newalpobject(port); -} - -static PyObject * -al_newconfig(PyObject *self, PyObject *args) -{ - ALconfig config; - - if (!PyArg_ParseTuple(args, ":NewConfig")) - return NULL; - if ((config = ALnewconfig ()) == NULL) - return NULL; - return newalcobject(config); -} - -static PyObject * -al_queryparams(PyObject *self, PyObject *args) -{ - long device; - long length; - long *PVbuffer; - long PVdummy[2]; - PyObject *v = NULL; - int i; - - if (!PyArg_ParseTuple(args, "l:queryparams", &device)) - return NULL; - if ((length = ALqueryparams(device, PVdummy, 2L)) == -1) - return NULL; - if ((PVbuffer = PyMem_NEW(long, length)) == NULL) - return PyErr_NoMemory(); - if (ALqueryparams(device, PVbuffer, length) >= 0 && - (v = PyList_New((int)length)) != NULL) { - for (i = 0; i < length; i++) - PyList_SetItem(v, i, PyInt_FromLong(PVbuffer[i])); - } - PyMem_DEL(PVbuffer); - return v; -} - -static PyObject * -doParams(PyObject *args, int (*func)(long, long *, long), int modified) -{ - long device; - PyObject *list, *v; - long *PVbuffer; - long length; - int i; - - if (!PyArg_ParseTuple(args, "lO!", &device, &PyList_Type, &list)) - return NULL; - length = PyList_Size(list); - PVbuffer = PyMem_NEW(long, length); - if (PVbuffer == NULL) - return PyErr_NoMemory(); - for (i = 0; i < length; i++) { - v = PyList_GetItem(list, i); - if (!PyInt_Check(v)) { - PyMem_DEL(PVbuffer); - PyErr_BadArgument(); - return NULL; - } - PVbuffer[i] = PyInt_AsLong(v); - } - - if ((*func)(device, PVbuffer, length) == -1) { - PyMem_DEL(PVbuffer); - return NULL; - } - - if (modified) { - for (i = 0; i < length; i++) - PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i])); - } - - PyMem_DEL(PVbuffer); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -al_getparams(PyObject *self, PyObject *args) -{ - return doParams(args, ALgetparams, 1); -} - -static PyObject * -al_setparams(PyObject *self, PyObject *args) -{ - return doParams(args, ALsetparams, 0); -} - -static PyObject * -al_getname(PyObject *self, PyObject *args) -{ - long device, descriptor; - char *name; - - if (!PyArg_ParseTuple(args, "ll:getname", &device, &descriptor)) - return NULL; - if ((name = ALgetname(device, descriptor)) == NULL) - return NULL; - return PyString_FromString(name); -} - -static PyObject * -al_getdefault(PyObject *self, PyObject *args) -{ - long device, descriptor, value; - - if (!PyArg_ParseTuple(args, "ll:getdefault", &device, &descriptor)) - return NULL; - if ((value = ALgetdefault(device, descriptor)) == -1) - return NULL; - return PyLong_FromLong(value); -} - -static PyObject * -al_getminmax(PyObject *self, PyObject *args) -{ - long device, descriptor, min, max; - - if (!PyArg_ParseTuple(args, "ll:getminmax", &device, &descriptor)) - return NULL; - min = -1; - max = -1; - if (ALgetminmax(device, descriptor, &min, &max) == -1) - return NULL; - return Py_BuildValue("ll", min, max); -} - -#endif /* OLD_INTERFACE */ - -/* List of methods defined in the module */ - -static struct PyMethodDef al_methods[] = { -#ifdef AL_NO_ELEM /* IRIX 6 */ - {"NewConfig", (PyCFunction)al_NewConfig, METH_VARARGS, al_NewConfig__doc__}, - {"OpenPort", (PyCFunction)al_OpenPort, METH_VARARGS, al_OpenPort__doc__}, - {"Connect", (PyCFunction)al_Connect, METH_VARARGS, al_Connect__doc__}, - {"Disconnect", (PyCFunction)al_Disconnect, METH_VARARGS, al_Disconnect__doc__}, - {"GetParams", (PyCFunction)al_GetParams, METH_VARARGS, al_GetParams__doc__}, - {"SetParams", (PyCFunction)al_SetParams, METH_VARARGS, al_SetParams__doc__}, - {"QueryValues", (PyCFunction)al_QueryValues, METH_VARARGS, al_QueryValues__doc__}, - {"GetParamInfo", (PyCFunction)al_GetParamInfo, METH_VARARGS, al_GetParamInfo__doc__}, - {"GetResourceByName", (PyCFunction)al_GetResourceByName, METH_VARARGS, al_GetResourceByName__doc__}, - {"IsSubtype", (PyCFunction)al_IsSubtype, METH_VARARGS, al_IsSubtype__doc__}, -#if 0 - /* this one not supported */ - {"SetErrorHandler", (PyCFunction)al_SetErrorHandler, METH_VARARGS, al_SetErrorHandler__doc__}, -#endif -#endif /* AL_NO_ELEM */ -#ifdef OLD_INTERFACE - {"openport", (PyCFunction)al_openport, METH_VARARGS}, - {"newconfig", (PyCFunction)al_newconfig, METH_VARARGS}, - {"queryparams", (PyCFunction)al_queryparams, METH_VARARGS}, - {"getparams", (PyCFunction)al_getparams, METH_VARARGS}, - {"setparams", (PyCFunction)al_setparams, METH_VARARGS}, - {"getname", (PyCFunction)al_getname, METH_VARARGS}, - {"getdefault", (PyCFunction)al_getdefault, METH_VARARGS}, - {"getminmax", (PyCFunction)al_getminmax, METH_VARARGS}, -#endif /* OLD_INTERFACE */ - - {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */ -}; - - -/* Initialization function for the module (*must* be called inital) */ - -PyDoc_STRVAR(al_module_documentation, ""); - -void -inital(void) -{ - PyObject *m, *d, *x; - - /* Create the module and add the functions */ - m = Py_InitModule4("al", al_methods, - al_module_documentation, - (PyObject*)NULL,PYTHON_API_VERSION); - if (m == NULL) - return; - - /* Add some symbolic constants to the module */ - d = PyModule_GetDict(m); - ErrorObject = PyErr_NewException("al.error", NULL, NULL); - PyDict_SetItemString(d, "error", ErrorObject); - - /* XXXX Add constants here */ -#ifdef AL_4CHANNEL - x = PyInt_FromLong((long) AL_4CHANNEL); - if (x == NULL || PyDict_SetItemString(d, "FOURCHANNEL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ADAT_IF_TYPE - x = PyInt_FromLong((long) AL_ADAT_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "ADAT_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ADAT_MCLK_TYPE - x = PyInt_FromLong((long) AL_ADAT_MCLK_TYPE); - if (x == NULL || PyDict_SetItemString(d, "ADAT_MCLK_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_AES_IF_TYPE - x = PyInt_FromLong((long) AL_AES_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "AES_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_AES_MCLK_TYPE - x = PyInt_FromLong((long) AL_AES_MCLK_TYPE); - if (x == NULL || PyDict_SetItemString(d, "AES_MCLK_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ANALOG_IF_TYPE - x = PyInt_FromLong((long) AL_ANALOG_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "ANALOG_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ASSOCIATE - x = PyInt_FromLong((long) AL_ASSOCIATE); - if (x == NULL || PyDict_SetItemString(d, "ASSOCIATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_BUFFER_NULL - x = PyInt_FromLong((long) AL_BAD_BUFFER_NULL); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_NULL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_BUFFERLENGTH - x = PyInt_FromLong((long) AL_BAD_BUFFERLENGTH); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_BUFFERLENGTH_NEG - x = PyInt_FromLong((long) AL_BAD_BUFFERLENGTH_NEG); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_NEG", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_BUFFERLENGTH_ODD - x = PyInt_FromLong((long) AL_BAD_BUFFERLENGTH_ODD); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_ODD", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_CHANNELS - x = PyInt_FromLong((long) AL_BAD_CHANNELS); - if (x == NULL || PyDict_SetItemString(d, "BAD_CHANNELS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_CONFIG - x = PyInt_FromLong((long) AL_BAD_CONFIG); - if (x == NULL || PyDict_SetItemString(d, "BAD_CONFIG", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_COUNT_NEG - x = PyInt_FromLong((long) AL_BAD_COUNT_NEG); - if (x == NULL || PyDict_SetItemString(d, "BAD_COUNT_NEG", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_DEVICE - x = PyInt_FromLong((long) AL_BAD_DEVICE); - if (x == NULL || PyDict_SetItemString(d, "BAD_DEVICE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_DEVICE_ACCESS - x = PyInt_FromLong((long) AL_BAD_DEVICE_ACCESS); - if (x == NULL || PyDict_SetItemString(d, "BAD_DEVICE_ACCESS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_DIRECTION - x = PyInt_FromLong((long) AL_BAD_DIRECTION); - if (x == NULL || PyDict_SetItemString(d, "BAD_DIRECTION", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_FILLPOINT - x = PyInt_FromLong((long) AL_BAD_FILLPOINT); - if (x == NULL || PyDict_SetItemString(d, "BAD_FILLPOINT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_FLOATMAX - x = PyInt_FromLong((long) AL_BAD_FLOATMAX); - if (x == NULL || PyDict_SetItemString(d, "BAD_FLOATMAX", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_ILLEGAL_STATE - x = PyInt_FromLong((long) AL_BAD_ILLEGAL_STATE); - if (x == NULL || PyDict_SetItemString(d, "BAD_ILLEGAL_STATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_NO_PORTS - x = PyInt_FromLong((long) AL_BAD_NO_PORTS); - if (x == NULL || PyDict_SetItemString(d, "BAD_NO_PORTS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_NOT_FOUND - x = PyInt_FromLong((long) AL_BAD_NOT_FOUND); - if (x == NULL || PyDict_SetItemString(d, "BAD_NOT_FOUND", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_NOT_IMPLEMENTED - x = PyInt_FromLong((long) AL_BAD_NOT_IMPLEMENTED); - if (x == NULL || PyDict_SetItemString(d, "BAD_NOT_IMPLEMENTED", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_OUT_OF_MEM - x = PyInt_FromLong((long) AL_BAD_OUT_OF_MEM); - if (x == NULL || PyDict_SetItemString(d, "BAD_OUT_OF_MEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_PARAM - x = PyInt_FromLong((long) AL_BAD_PARAM); - if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_PERMISSIONS - x = PyInt_FromLong((long) AL_BAD_PERMISSIONS); - if (x == NULL || PyDict_SetItemString(d, "BAD_PERMISSIONS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_PORT - x = PyInt_FromLong((long) AL_BAD_PORT); - if (x == NULL || PyDict_SetItemString(d, "BAD_PORT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_PORTSTYLE - x = PyInt_FromLong((long) AL_BAD_PORTSTYLE); - if (x == NULL || PyDict_SetItemString(d, "BAD_PORTSTYLE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_PVBUFFER - x = PyInt_FromLong((long) AL_BAD_PVBUFFER); - if (x == NULL || PyDict_SetItemString(d, "BAD_PVBUFFER", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_QSIZE - x = PyInt_FromLong((long) AL_BAD_QSIZE); - if (x == NULL || PyDict_SetItemString(d, "BAD_QSIZE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_RATE - x = PyInt_FromLong((long) AL_BAD_RATE); - if (x == NULL || PyDict_SetItemString(d, "BAD_RATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_RESOURCE - x = PyInt_FromLong((long) AL_BAD_RESOURCE); - if (x == NULL || PyDict_SetItemString(d, "BAD_RESOURCE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_SAMPFMT - x = PyInt_FromLong((long) AL_BAD_SAMPFMT); - if (x == NULL || PyDict_SetItemString(d, "BAD_SAMPFMT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_TRANSFER_SIZE - x = PyInt_FromLong((long) AL_BAD_TRANSFER_SIZE); - if (x == NULL || PyDict_SetItemString(d, "BAD_TRANSFER_SIZE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_BAD_WIDTH - x = PyInt_FromLong((long) AL_BAD_WIDTH); - if (x == NULL || PyDict_SetItemString(d, "BAD_WIDTH", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CHANNEL_MODE - x = PyInt_FromLong((long) AL_CHANNEL_MODE); - if (x == NULL || PyDict_SetItemString(d, "CHANNEL_MODE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CHANNELS - x = PyInt_FromLong((long) AL_CHANNELS); - if (x == NULL || PyDict_SetItemString(d, "CHANNELS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CHAR_ELEM - x = PyInt_FromLong((long) AL_CHAR_ELEM); - if (x == NULL || PyDict_SetItemString(d, "CHAR_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CLOCK_GEN - x = PyInt_FromLong((long) AL_CLOCK_GEN); - if (x == NULL || PyDict_SetItemString(d, "CLOCK_GEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CLOCKGEN_TYPE - x = PyInt_FromLong((long) AL_CLOCKGEN_TYPE); - if (x == NULL || PyDict_SetItemString(d, "CLOCKGEN_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CONNECT - x = PyInt_FromLong((long) AL_CONNECT); - if (x == NULL || PyDict_SetItemString(d, "CONNECT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CONNECTION_TYPE - x = PyInt_FromLong((long) AL_CONNECTION_TYPE); - if (x == NULL || PyDict_SetItemString(d, "CONNECTION_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CONNECTIONS - x = PyInt_FromLong((long) AL_CONNECTIONS); - if (x == NULL || PyDict_SetItemString(d, "CONNECTIONS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_CRYSTAL_MCLK_TYPE - x = PyInt_FromLong((long) AL_CRYSTAL_MCLK_TYPE); - if (x == NULL || PyDict_SetItemString(d, "CRYSTAL_MCLK_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DEFAULT_DEVICE - x = PyInt_FromLong((long) AL_DEFAULT_DEVICE); - if (x == NULL || PyDict_SetItemString(d, "DEFAULT_DEVICE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DEFAULT_INPUT - x = PyInt_FromLong((long) AL_DEFAULT_INPUT); - if (x == NULL || PyDict_SetItemString(d, "DEFAULT_INPUT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DEFAULT_OUTPUT - x = PyInt_FromLong((long) AL_DEFAULT_OUTPUT); - if (x == NULL || PyDict_SetItemString(d, "DEFAULT_OUTPUT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DEST - x = PyInt_FromLong((long) AL_DEST); - if (x == NULL || PyDict_SetItemString(d, "DEST", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DEVICE_TYPE - x = PyInt_FromLong((long) AL_DEVICE_TYPE); - if (x == NULL || PyDict_SetItemString(d, "DEVICE_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DEVICES - x = PyInt_FromLong((long) AL_DEVICES); - if (x == NULL || PyDict_SetItemString(d, "DEVICES", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DIGITAL_IF_TYPE - x = PyInt_FromLong((long) AL_DIGITAL_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "DIGITAL_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DIGITAL_INPUT_RATE - x = PyInt_FromLong((long) AL_DIGITAL_INPUT_RATE); - if (x == NULL || PyDict_SetItemString(d, "DIGITAL_INPUT_RATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_DISCONNECT - x = PyInt_FromLong((long) AL_DISCONNECT); - if (x == NULL || PyDict_SetItemString(d, "DISCONNECT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ENUM_ELEM - x = PyInt_FromLong((long) AL_ENUM_ELEM); - if (x == NULL || PyDict_SetItemString(d, "ENUM_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ENUM_VALUE - x = PyInt_FromLong((long) AL_ENUM_VALUE); - if (x == NULL || PyDict_SetItemString(d, "ENUM_VALUE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ERROR_INPUT_OVERFLOW - x = PyInt_FromLong((long) AL_ERROR_INPUT_OVERFLOW); - if (x == NULL || PyDict_SetItemString(d, "ERROR_INPUT_OVERFLOW", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ERROR_LENGTH - x = PyInt_FromLong((long) AL_ERROR_LENGTH); - if (x == NULL || PyDict_SetItemString(d, "ERROR_LENGTH", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ERROR_LOCATION_LSP - x = PyInt_FromLong((long) AL_ERROR_LOCATION_LSP); - if (x == NULL || PyDict_SetItemString(d, "ERROR_LOCATION_LSP", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ERROR_LOCATION_MSP - x = PyInt_FromLong((long) AL_ERROR_LOCATION_MSP); - if (x == NULL || PyDict_SetItemString(d, "ERROR_LOCATION_MSP", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ERROR_NUMBER - x = PyInt_FromLong((long) AL_ERROR_NUMBER); - if (x == NULL || PyDict_SetItemString(d, "ERROR_NUMBER", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ERROR_OUTPUT_UNDERFLOW - x = PyInt_FromLong((long) AL_ERROR_OUTPUT_UNDERFLOW); - if (x == NULL || PyDict_SetItemString(d, "ERROR_OUTPUT_UNDERFLOW", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_ERROR_TYPE - x = PyInt_FromLong((long) AL_ERROR_TYPE); - if (x == NULL || PyDict_SetItemString(d, "ERROR_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_FIXED_ELEM - x = PyInt_FromLong((long) AL_FIXED_ELEM); - if (x == NULL || PyDict_SetItemString(d, "FIXED_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_FIXED_MCLK_TYPE - x = PyInt_FromLong((long) AL_FIXED_MCLK_TYPE); - if (x == NULL || PyDict_SetItemString(d, "FIXED_MCLK_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_GAIN - x = PyInt_FromLong((long) AL_GAIN); - if (x == NULL || PyDict_SetItemString(d, "GAIN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_GAIN_REF - x = PyInt_FromLong((long) AL_GAIN_REF); - if (x == NULL || PyDict_SetItemString(d, "GAIN_REF", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_HRB_TYPE - x = PyInt_FromLong((long) AL_HRB_TYPE); - if (x == NULL || PyDict_SetItemString(d, "HRB_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_COUNT - x = PyInt_FromLong((long) AL_INPUT_COUNT); - if (x == NULL || PyDict_SetItemString(d, "INPUT_COUNT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_DEVICE_TYPE - x = PyInt_FromLong((long) AL_INPUT_DEVICE_TYPE); - if (x == NULL || PyDict_SetItemString(d, "INPUT_DEVICE_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_DIGITAL - x = PyInt_FromLong((long) AL_INPUT_DIGITAL); - if (x == NULL || PyDict_SetItemString(d, "INPUT_DIGITAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_HRB_TYPE - x = PyInt_FromLong((long) AL_INPUT_HRB_TYPE); - if (x == NULL || PyDict_SetItemString(d, "INPUT_HRB_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_LINE - x = PyInt_FromLong((long) AL_INPUT_LINE); - if (x == NULL || PyDict_SetItemString(d, "INPUT_LINE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_MIC - x = PyInt_FromLong((long) AL_INPUT_MIC); - if (x == NULL || PyDict_SetItemString(d, "INPUT_MIC", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_PORT_TYPE - x = PyInt_FromLong((long) AL_INPUT_PORT_TYPE); - if (x == NULL || PyDict_SetItemString(d, "INPUT_PORT_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_RATE - x = PyInt_FromLong((long) AL_INPUT_RATE); - if (x == NULL || PyDict_SetItemString(d, "INPUT_RATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INPUT_SOURCE - x = PyInt_FromLong((long) AL_INPUT_SOURCE); - if (x == NULL || PyDict_SetItemString(d, "INPUT_SOURCE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INT32_ELEM - x = PyInt_FromLong((long) AL_INT32_ELEM); - if (x == NULL || PyDict_SetItemString(d, "INT32_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INT64_ELEM - x = PyInt_FromLong((long) AL_INT64_ELEM); - if (x == NULL || PyDict_SetItemString(d, "INT64_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INTERFACE - x = PyInt_FromLong((long) AL_INTERFACE); - if (x == NULL || PyDict_SetItemString(d, "INTERFACE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INTERFACE_TYPE - x = PyInt_FromLong((long) AL_INTERFACE_TYPE); - if (x == NULL || PyDict_SetItemString(d, "INTERFACE_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INVALID_PARAM - x = PyInt_FromLong((long) AL_INVALID_PARAM); - if (x == NULL || PyDict_SetItemString(d, "INVALID_PARAM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_INVALID_VALUE - x = PyInt_FromLong((long) AL_INVALID_VALUE); - if (x == NULL || PyDict_SetItemString(d, "INVALID_VALUE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_JITTER - x = PyInt_FromLong((long) AL_JITTER); - if (x == NULL || PyDict_SetItemString(d, "JITTER", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LABEL - x = PyInt_FromLong((long) AL_LABEL); - if (x == NULL || PyDict_SetItemString(d, "LABEL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LEFT_INPUT_ATTEN - x = PyInt_FromLong((long) AL_LEFT_INPUT_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "LEFT_INPUT_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LEFT_MONITOR_ATTEN - x = PyInt_FromLong((long) AL_LEFT_MONITOR_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "LEFT_MONITOR_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LEFT_SPEAKER_GAIN - x = PyInt_FromLong((long) AL_LEFT_SPEAKER_GAIN); - if (x == NULL || PyDict_SetItemString(d, "LEFT_SPEAKER_GAIN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LEFT1_INPUT_ATTEN - x = PyInt_FromLong((long) AL_LEFT1_INPUT_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "LEFT1_INPUT_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LEFT2_INPUT_ATTEN - x = PyInt_FromLong((long) AL_LEFT2_INPUT_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "LEFT2_INPUT_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LINE_IF_TYPE - x = PyInt_FromLong((long) AL_LINE_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "LINE_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_LOCKED - x = PyInt_FromLong((long) AL_LOCKED); - if (x == NULL || PyDict_SetItemString(d, "LOCKED", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MASTER_CLOCK - x = PyInt_FromLong((long) AL_MASTER_CLOCK); - if (x == NULL || PyDict_SetItemString(d, "MASTER_CLOCK", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MATRIX_VAL - x = PyInt_FromLong((long) AL_MATRIX_VAL); - if (x == NULL || PyDict_SetItemString(d, "MATRIX_VAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MAX_ERROR - x = PyInt_FromLong((long) AL_MAX_ERROR); - if (x == NULL || PyDict_SetItemString(d, "MAX_ERROR", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MAX_EVENT_PARAM - x = PyInt_FromLong((long) AL_MAX_EVENT_PARAM); - if (x == NULL || PyDict_SetItemString(d, "MAX_EVENT_PARAM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MAX_PBUFSIZE - x = PyInt_FromLong((long) AL_MAX_PBUFSIZE); - if (x == NULL || PyDict_SetItemString(d, "MAX_PBUFSIZE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MAX_PORTS - x = PyInt_FromLong((long) AL_MAX_PORTS); - if (x == NULL || PyDict_SetItemString(d, "MAX_PORTS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MAX_RESOURCE_ID - x = PyInt_FromLong((long) AL_MAX_RESOURCE_ID); - if (x == NULL || PyDict_SetItemString(d, "MAX_RESOURCE_ID", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MAX_SETSIZE - x = PyInt_FromLong((long) AL_MAX_SETSIZE); - if (x == NULL || PyDict_SetItemString(d, "MAX_SETSIZE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MAX_STRLEN - x = PyInt_FromLong((long) AL_MAX_STRLEN); - if (x == NULL || PyDict_SetItemString(d, "MAX_STRLEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MCLK_TYPE - x = PyInt_FromLong((long) AL_MCLK_TYPE); - if (x == NULL || PyDict_SetItemString(d, "MCLK_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MIC_IF_TYPE - x = PyInt_FromLong((long) AL_MIC_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "MIC_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MONITOR_CTL - x = PyInt_FromLong((long) AL_MONITOR_CTL); - if (x == NULL || PyDict_SetItemString(d, "MONITOR_CTL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MONITOR_OFF - x = PyInt_FromLong((long) AL_MONITOR_OFF); - if (x == NULL || PyDict_SetItemString(d, "MONITOR_OFF", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MONITOR_ON - x = PyInt_FromLong((long) AL_MONITOR_ON); - if (x == NULL || PyDict_SetItemString(d, "MONITOR_ON", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MONO - x = PyInt_FromLong((long) AL_MONO); - if (x == NULL || PyDict_SetItemString(d, "MONO", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_MUTE - x = PyInt_FromLong((long) AL_MUTE); - if (x == NULL || PyDict_SetItemString(d, "MUTE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NAME - x = PyInt_FromLong((long) AL_NAME); - if (x == NULL || PyDict_SetItemString(d, "NAME", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NEG_INFINITY - x = PyInt_FromLong((long) AL_NEG_INFINITY); - if (x == NULL || PyDict_SetItemString(d, "NEG_INFINITY", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NEG_INFINITY_BIT - x = PyInt_FromLong((long) AL_NEG_INFINITY_BIT); - if (x == NULL || PyDict_SetItemString(d, "NEG_INFINITY_BIT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NO_CHANGE - x = PyInt_FromLong((long) AL_NO_CHANGE); - if (x == NULL || PyDict_SetItemString(d, "NO_CHANGE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NO_CHANGE_BIT - x = PyInt_FromLong((long) AL_NO_CHANGE_BIT); - if (x == NULL || PyDict_SetItemString(d, "NO_CHANGE_BIT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NO_ELEM - x = PyInt_FromLong((long) AL_NO_ELEM); - if (x == NULL || PyDict_SetItemString(d, "NO_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NO_ERRORS - x = PyInt_FromLong((long) AL_NO_ERRORS); - if (x == NULL || PyDict_SetItemString(d, "NO_ERRORS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NO_OP - x = PyInt_FromLong((long) AL_NO_OP); - if (x == NULL || PyDict_SetItemString(d, "NO_OP", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NO_VAL - x = PyInt_FromLong((long) AL_NO_VAL); - if (x == NULL || PyDict_SetItemString(d, "NO_VAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NULL_INTERFACE - x = PyInt_FromLong((long) AL_NULL_INTERFACE); - if (x == NULL || PyDict_SetItemString(d, "NULL_INTERFACE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_NULL_RESOURCE - x = PyInt_FromLong((long) AL_NULL_RESOURCE); - if (x == NULL || PyDict_SetItemString(d, "NULL_RESOURCE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_OPTICAL_IF_TYPE - x = PyInt_FromLong((long) AL_OPTICAL_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "OPTICAL_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_OUTPUT_COUNT - x = PyInt_FromLong((long) AL_OUTPUT_COUNT); - if (x == NULL || PyDict_SetItemString(d, "OUTPUT_COUNT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_OUTPUT_DEVICE_TYPE - x = PyInt_FromLong((long) AL_OUTPUT_DEVICE_TYPE); - if (x == NULL || PyDict_SetItemString(d, "OUTPUT_DEVICE_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_OUTPUT_HRB_TYPE - x = PyInt_FromLong((long) AL_OUTPUT_HRB_TYPE); - if (x == NULL || PyDict_SetItemString(d, "OUTPUT_HRB_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_OUTPUT_PORT_TYPE - x = PyInt_FromLong((long) AL_OUTPUT_PORT_TYPE); - if (x == NULL || PyDict_SetItemString(d, "OUTPUT_PORT_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_OUTPUT_RATE - x = PyInt_FromLong((long) AL_OUTPUT_RATE); - if (x == NULL || PyDict_SetItemString(d, "OUTPUT_RATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PARAM_BIT - x = PyInt_FromLong((long) AL_PARAM_BIT); - if (x == NULL || PyDict_SetItemString(d, "PARAM_BIT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PARAMS - x = PyInt_FromLong((long) AL_PARAMS); - if (x == NULL || PyDict_SetItemString(d, "PARAMS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PORT_COUNT - x = PyInt_FromLong((long) AL_PORT_COUNT); - if (x == NULL || PyDict_SetItemString(d, "PORT_COUNT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PORT_TYPE - x = PyInt_FromLong((long) AL_PORT_TYPE); - if (x == NULL || PyDict_SetItemString(d, "PORT_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PORTS - x = PyInt_FromLong((long) AL_PORTS); - if (x == NULL || PyDict_SetItemString(d, "PORTS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PORTSTYLE_DIRECT - x = PyInt_FromLong((long) AL_PORTSTYLE_DIRECT); - if (x == NULL || PyDict_SetItemString(d, "PORTSTYLE_DIRECT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PORTSTYLE_SERIAL - x = PyInt_FromLong((long) AL_PORTSTYLE_SERIAL); - if (x == NULL || PyDict_SetItemString(d, "PORTSTYLE_SERIAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PRINT_ERRORS - x = PyInt_FromLong((long) AL_PRINT_ERRORS); - if (x == NULL || PyDict_SetItemString(d, "PRINT_ERRORS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_PTR_ELEM - x = PyInt_FromLong((long) AL_PTR_ELEM); - if (x == NULL || PyDict_SetItemString(d, "PTR_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RANGE_VALUE - x = PyInt_FromLong((long) AL_RANGE_VALUE); - if (x == NULL || PyDict_SetItemString(d, "RANGE_VALUE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE - x = PyInt_FromLong((long) AL_RATE); - if (x == NULL || PyDict_SetItemString(d, "RATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_11025 - x = PyInt_FromLong((long) AL_RATE_11025); - if (x == NULL || PyDict_SetItemString(d, "RATE_11025", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_16000 - x = PyInt_FromLong((long) AL_RATE_16000); - if (x == NULL || PyDict_SetItemString(d, "RATE_16000", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_22050 - x = PyInt_FromLong((long) AL_RATE_22050); - if (x == NULL || PyDict_SetItemString(d, "RATE_22050", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_32000 - x = PyInt_FromLong((long) AL_RATE_32000); - if (x == NULL || PyDict_SetItemString(d, "RATE_32000", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_44100 - x = PyInt_FromLong((long) AL_RATE_44100); - if (x == NULL || PyDict_SetItemString(d, "RATE_44100", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_48000 - x = PyInt_FromLong((long) AL_RATE_48000); - if (x == NULL || PyDict_SetItemString(d, "RATE_48000", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_8000 - x = PyInt_FromLong((long) AL_RATE_8000); - if (x == NULL || PyDict_SetItemString(d, "RATE_8000", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_AES_1 - x = PyInt_FromLong((long) AL_RATE_AES_1); - if (x == NULL || PyDict_SetItemString(d, "RATE_AES_1", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_AES_1s - x = PyInt_FromLong((long) AL_RATE_AES_1s); - if (x == NULL || PyDict_SetItemString(d, "RATE_AES_1s", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_AES_2 - x = PyInt_FromLong((long) AL_RATE_AES_2); - if (x == NULL || PyDict_SetItemString(d, "RATE_AES_2", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_AES_3 - x = PyInt_FromLong((long) AL_RATE_AES_3); - if (x == NULL || PyDict_SetItemString(d, "RATE_AES_3", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_AES_4 - x = PyInt_FromLong((long) AL_RATE_AES_4); - if (x == NULL || PyDict_SetItemString(d, "RATE_AES_4", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_AES_6 - x = PyInt_FromLong((long) AL_RATE_AES_6); - if (x == NULL || PyDict_SetItemString(d, "RATE_AES_6", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_FRACTION_D - x = PyInt_FromLong((long) AL_RATE_FRACTION_D); - if (x == NULL || PyDict_SetItemString(d, "RATE_FRACTION_D", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_FRACTION_N - x = PyInt_FromLong((long) AL_RATE_FRACTION_N); - if (x == NULL || PyDict_SetItemString(d, "RATE_FRACTION_N", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_INPUTRATE - x = PyInt_FromLong((long) AL_RATE_INPUTRATE); - if (x == NULL || PyDict_SetItemString(d, "RATE_INPUTRATE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_NO_DIGITAL_INPUT - x = PyInt_FromLong((long) AL_RATE_NO_DIGITAL_INPUT); - if (x == NULL || PyDict_SetItemString(d, "RATE_NO_DIGITAL_INPUT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_UNACQUIRED - x = PyInt_FromLong((long) AL_RATE_UNACQUIRED); - if (x == NULL || PyDict_SetItemString(d, "RATE_UNACQUIRED", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RATE_UNDEFINED - x = PyInt_FromLong((long) AL_RATE_UNDEFINED); - if (x == NULL || PyDict_SetItemString(d, "RATE_UNDEFINED", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_REF_0DBV - x = PyInt_FromLong((long) AL_REF_0DBV); - if (x == NULL || PyDict_SetItemString(d, "REF_0DBV", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_REF_NONE - x = PyInt_FromLong((long) AL_REF_NONE); - if (x == NULL || PyDict_SetItemString(d, "REF_NONE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RESERVED1_TYPE - x = PyInt_FromLong((long) AL_RESERVED1_TYPE); - if (x == NULL || PyDict_SetItemString(d, "RESERVED1_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RESERVED2_TYPE - x = PyInt_FromLong((long) AL_RESERVED2_TYPE); - if (x == NULL || PyDict_SetItemString(d, "RESERVED2_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RESERVED3_TYPE - x = PyInt_FromLong((long) AL_RESERVED3_TYPE); - if (x == NULL || PyDict_SetItemString(d, "RESERVED3_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RESERVED4_TYPE - x = PyInt_FromLong((long) AL_RESERVED4_TYPE); - if (x == NULL || PyDict_SetItemString(d, "RESERVED4_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RESOURCE - x = PyInt_FromLong((long) AL_RESOURCE); - if (x == NULL || PyDict_SetItemString(d, "RESOURCE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RESOURCE_ELEM - x = PyInt_FromLong((long) AL_RESOURCE_ELEM); - if (x == NULL || PyDict_SetItemString(d, "RESOURCE_ELEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RESOURCE_TYPE - x = PyInt_FromLong((long) AL_RESOURCE_TYPE); - if (x == NULL || PyDict_SetItemString(d, "RESOURCE_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RIGHT_INPUT_ATTEN - x = PyInt_FromLong((long) AL_RIGHT_INPUT_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "RIGHT_INPUT_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RIGHT_MONITOR_ATTEN - x = PyInt_FromLong((long) AL_RIGHT_MONITOR_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "RIGHT_MONITOR_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RIGHT_SPEAKER_GAIN - x = PyInt_FromLong((long) AL_RIGHT_SPEAKER_GAIN); - if (x == NULL || PyDict_SetItemString(d, "RIGHT_SPEAKER_GAIN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RIGHT1_INPUT_ATTEN - x = PyInt_FromLong((long) AL_RIGHT1_INPUT_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "RIGHT1_INPUT_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_RIGHT2_INPUT_ATTEN - x = PyInt_FromLong((long) AL_RIGHT2_INPUT_ATTEN); - if (x == NULL || PyDict_SetItemString(d, "RIGHT2_INPUT_ATTEN", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SAMPFMT_DOUBLE - x = PyInt_FromLong((long) AL_SAMPFMT_DOUBLE); - if (x == NULL || PyDict_SetItemString(d, "SAMPFMT_DOUBLE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SAMPFMT_FLOAT - x = PyInt_FromLong((long) AL_SAMPFMT_FLOAT); - if (x == NULL || PyDict_SetItemString(d, "SAMPFMT_FLOAT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SAMPFMT_TWOSCOMP - x = PyInt_FromLong((long) AL_SAMPFMT_TWOSCOMP); - if (x == NULL || PyDict_SetItemString(d, "SAMPFMT_TWOSCOMP", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SAMPLE_16 - x = PyInt_FromLong((long) AL_SAMPLE_16); - if (x == NULL || PyDict_SetItemString(d, "SAMPLE_16", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SAMPLE_24 - x = PyInt_FromLong((long) AL_SAMPLE_24); - if (x == NULL || PyDict_SetItemString(d, "SAMPLE_24", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SAMPLE_8 - x = PyInt_FromLong((long) AL_SAMPLE_8); - if (x == NULL || PyDict_SetItemString(d, "SAMPLE_8", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SCALAR_VAL - x = PyInt_FromLong((long) AL_SCALAR_VAL); - if (x == NULL || PyDict_SetItemString(d, "SCALAR_VAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SET_VAL - x = PyInt_FromLong((long) AL_SET_VAL); - if (x == NULL || PyDict_SetItemString(d, "SET_VAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SHORT_NAME - x = PyInt_FromLong((long) AL_SHORT_NAME); - if (x == NULL || PyDict_SetItemString(d, "SHORT_NAME", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SMPTE272M_IF_TYPE - x = PyInt_FromLong((long) AL_SMPTE272M_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "SMPTE272M_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SOURCE - x = PyInt_FromLong((long) AL_SOURCE); - if (x == NULL || PyDict_SetItemString(d, "SOURCE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SPEAKER_IF_TYPE - x = PyInt_FromLong((long) AL_SPEAKER_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "SPEAKER_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SPEAKER_MUTE_CTL - x = PyInt_FromLong((long) AL_SPEAKER_MUTE_CTL); - if (x == NULL || PyDict_SetItemString(d, "SPEAKER_MUTE_CTL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SPEAKER_MUTE_OFF - x = PyInt_FromLong((long) AL_SPEAKER_MUTE_OFF); - if (x == NULL || PyDict_SetItemString(d, "SPEAKER_MUTE_OFF", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SPEAKER_MUTE_ON - x = PyInt_FromLong((long) AL_SPEAKER_MUTE_ON); - if (x == NULL || PyDict_SetItemString(d, "SPEAKER_MUTE_ON", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SPEAKER_PLUS_LINE_IF_TYPE - x = PyInt_FromLong((long) AL_SPEAKER_PLUS_LINE_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "SPEAKER_PLUS_LINE_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_STEREO - x = PyInt_FromLong((long) AL_STEREO); - if (x == NULL || PyDict_SetItemString(d, "STEREO", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_STRING_VAL - x = PyInt_FromLong((long) AL_STRING_VAL); - if (x == NULL || PyDict_SetItemString(d, "STRING_VAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SUBSYSTEM - x = PyInt_FromLong((long) AL_SUBSYSTEM); - if (x == NULL || PyDict_SetItemString(d, "SUBSYSTEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SUBSYSTEM_TYPE - x = PyInt_FromLong((long) AL_SUBSYSTEM_TYPE); - if (x == NULL || PyDict_SetItemString(d, "SUBSYSTEM_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SYNC_INPUT_TO_AES - x = PyInt_FromLong((long) AL_SYNC_INPUT_TO_AES); - if (x == NULL || PyDict_SetItemString(d, "SYNC_INPUT_TO_AES", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SYNC_OUTPUT_TO_AES - x = PyInt_FromLong((long) AL_SYNC_OUTPUT_TO_AES); - if (x == NULL || PyDict_SetItemString(d, "SYNC_OUTPUT_TO_AES", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SYSTEM - x = PyInt_FromLong((long) AL_SYSTEM); - if (x == NULL || PyDict_SetItemString(d, "SYSTEM", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_SYSTEM_TYPE - x = PyInt_FromLong((long) AL_SYSTEM_TYPE); - if (x == NULL || PyDict_SetItemString(d, "SYSTEM_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_TEST_IF_TYPE - x = PyInt_FromLong((long) AL_TEST_IF_TYPE); - if (x == NULL || PyDict_SetItemString(d, "TEST_IF_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_TYPE - x = PyInt_FromLong((long) AL_TYPE); - if (x == NULL || PyDict_SetItemString(d, "TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_TYPE_BIT - x = PyInt_FromLong((long) AL_TYPE_BIT); - if (x == NULL || PyDict_SetItemString(d, "TYPE_BIT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_UNUSED_COUNT - x = PyInt_FromLong((long) AL_UNUSED_COUNT); - if (x == NULL || PyDict_SetItemString(d, "UNUSED_COUNT", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_UNUSED_PORTS - x = PyInt_FromLong((long) AL_UNUSED_PORTS); - if (x == NULL || PyDict_SetItemString(d, "UNUSED_PORTS", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_VARIABLE_MCLK_TYPE - x = PyInt_FromLong((long) AL_VARIABLE_MCLK_TYPE); - if (x == NULL || PyDict_SetItemString(d, "VARIABLE_MCLK_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_VECTOR_VAL - x = PyInt_FromLong((long) AL_VECTOR_VAL); - if (x == NULL || PyDict_SetItemString(d, "VECTOR_VAL", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_VIDEO_MCLK_TYPE - x = PyInt_FromLong((long) AL_VIDEO_MCLK_TYPE); - if (x == NULL || PyDict_SetItemString(d, "VIDEO_MCLK_TYPE", x) < 0) - goto error; - Py_DECREF(x); -#endif -#ifdef AL_WORDSIZE - x = PyInt_FromLong((long) AL_WORDSIZE); - if (x == NULL || PyDict_SetItemString(d, "WORDSIZE", x) < 0) - goto error; - Py_DECREF(x); -#endif - -#ifdef AL_NO_ELEM /* IRIX 6 */ - (void) alSetErrorHandler(ErrorHandler); -#endif /* AL_NO_ELEM */ -#ifdef OLD_INTERFACE - (void) ALseterrorhandler(ErrorHandler); -#endif /* OLD_INTERFACE */ - - error: - return; -} diff --git a/Modules/bsddbmodule.c b/Modules/bsddbmodule.c deleted file mode 100644 index cccdf2a..0000000 --- a/Modules/bsddbmodule.c +++ /dev/null @@ -1,858 +0,0 @@ -/* Berkeley DB interface. - Author: Michael McLay - Hacked: Guido van Rossum - Btree and Recno additions plus sequence methods: David Ely - Hacked by Gustavo Niemeyer <niemeyer@conectiva.com> fixing recno - support. - - XXX To do: - - provide a way to access the various hash functions - - support more open flags - - The windows port of the Berkeley DB code is hard to find on the web: - www.nightmare.com/software.html -*/ - -#include "Python.h" -#ifdef WITH_THREAD -#include "pythread.h" -#endif - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#ifdef HAVE_DB_185_H -#include <db_185.h> -#else -#include <db.h> -#endif -/* Please don't include internal header files of the Berkeley db package - (it messes up the info required in the Setup file) */ - -typedef struct { - PyObject_HEAD - DB *di_bsddb; - int di_size; /* -1 means recompute */ - int di_type; -#ifdef WITH_THREAD - PyThread_type_lock di_lock; -#endif -} bsddbobject; - -static PyTypeObject Bsddbtype; - -#define is_bsddbobject(v) ((v)->ob_type == &Bsddbtype) -#define check_bsddbobject_open(v, r) if ((v)->di_bsddb == NULL) \ - { PyErr_SetString(BsddbError, \ - "BSDDB object has already been closed"); \ - return r; } - -static PyObject *BsddbError; - -static PyObject * -newdbhashobject(char *file, int flags, int mode, - int bsize, int ffactor, int nelem, int cachesize, - int hash, int lorder) -{ - bsddbobject *dp; - HASHINFO info; - - if ((dp = PyObject_New(bsddbobject, &Bsddbtype)) == NULL) - return NULL; - - info.bsize = bsize; - info.ffactor = ffactor; - info.nelem = nelem; - info.cachesize = cachesize; - info.hash = NULL; /* XXX should derive from hash argument */ - info.lorder = lorder; - -#ifdef O_BINARY - flags |= O_BINARY; -#endif - Py_BEGIN_ALLOW_THREADS - dp->di_bsddb = dbopen(file, flags, mode, DB_HASH, &info); - Py_END_ALLOW_THREADS - if (dp->di_bsddb == NULL) { - PyErr_SetFromErrno(BsddbError); -#ifdef WITH_THREAD - dp->di_lock = NULL; -#endif - Py_DECREF(dp); - return NULL; - } - - dp->di_size = -1; - dp->di_type = DB_HASH; - -#ifdef WITH_THREAD - dp->di_lock = PyThread_allocate_lock(); - if (dp->di_lock == NULL) { - PyErr_SetString(BsddbError, "can't allocate lock"); - Py_DECREF(dp); - return NULL; - } -#endif - - return (PyObject *)dp; -} - -static PyObject * -newdbbtobject(char *file, int flags, int mode, - int btflags, int cachesize, int maxkeypage, - int minkeypage, int psize, int lorder) -{ - bsddbobject *dp; - BTREEINFO info; - - if ((dp = PyObject_New(bsddbobject, &Bsddbtype)) == NULL) - return NULL; - - info.flags = btflags; - info.cachesize = cachesize; - info.maxkeypage = maxkeypage; - info.minkeypage = minkeypage; - info.psize = psize; - info.lorder = lorder; - info.compare = 0; /* Use default comparison functions, for now..*/ - info.prefix = 0; - -#ifdef O_BINARY - flags |= O_BINARY; -#endif - Py_BEGIN_ALLOW_THREADS - dp->di_bsddb = dbopen(file, flags, mode, DB_BTREE, &info); - Py_END_ALLOW_THREADS - if (dp->di_bsddb == NULL) { - PyErr_SetFromErrno(BsddbError); -#ifdef WITH_THREAD - dp->di_lock = NULL; -#endif - Py_DECREF(dp); - return NULL; - } - - dp->di_size = -1; - dp->di_type = DB_BTREE; - -#ifdef WITH_THREAD - dp->di_lock = PyThread_allocate_lock(); - if (dp->di_lock == NULL) { - PyErr_SetString(BsddbError, "can't allocate lock"); - Py_DECREF(dp); - return NULL; - } -#endif - - return (PyObject *)dp; -} - -static PyObject * -newdbrnobject(char *file, int flags, int mode, - int rnflags, int cachesize, int psize, int lorder, - size_t reclen, u_char bval, char *bfname) -{ - bsddbobject *dp; - RECNOINFO info; - int fd; - - if ((dp = PyObject_New(bsddbobject, &Bsddbtype)) == NULL) - return NULL; - - info.flags = rnflags; - info.cachesize = cachesize; - info.psize = psize; - info.lorder = lorder; - info.reclen = reclen; - info.bval = bval; - info.bfname = bfname; - -#ifdef O_BINARY - flags |= O_BINARY; -#endif - /* This is a hack to avoid a dbopen() bug that happens when - * it fails. */ - fd = open(file, flags); - if (fd == -1) { - dp->di_bsddb = NULL; - } - else { - close(fd); - Py_BEGIN_ALLOW_THREADS - dp->di_bsddb = dbopen(file, flags, mode, DB_RECNO, &info); - Py_END_ALLOW_THREADS - } - if (dp->di_bsddb == NULL) { - PyErr_SetFromErrno(BsddbError); -#ifdef WITH_THREAD - dp->di_lock = NULL; -#endif - Py_DECREF(dp); - return NULL; - } - - dp->di_size = -1; - dp->di_type = DB_RECNO; - -#ifdef WITH_THREAD - dp->di_lock = PyThread_allocate_lock(); - if (dp->di_lock == NULL) { - PyErr_SetString(BsddbError, "can't allocate lock"); - Py_DECREF(dp); - return NULL; - } -#endif - - return (PyObject *)dp; -} - -static void -bsddb_dealloc(bsddbobject *dp) -{ -#ifdef WITH_THREAD - if (dp->di_lock) { - PyThread_acquire_lock(dp->di_lock, 0); - PyThread_release_lock(dp->di_lock); - PyThread_free_lock(dp->di_lock); - dp->di_lock = NULL; - } -#endif - if (dp->di_bsddb != NULL) { - int status; - Py_BEGIN_ALLOW_THREADS - status = (dp->di_bsddb->close)(dp->di_bsddb); - Py_END_ALLOW_THREADS - if (status != 0) - fprintf(stderr, - "Python bsddb: close errno %d in dealloc\n", - errno); - } - PyObject_Del(dp); -} - -#ifdef WITH_THREAD -#define BSDDB_BGN_SAVE(_dp) \ - Py_BEGIN_ALLOW_THREADS PyThread_acquire_lock(_dp->di_lock,1); -#define BSDDB_END_SAVE(_dp) \ - PyThread_release_lock(_dp->di_lock); Py_END_ALLOW_THREADS -#else -#define BSDDB_BGN_SAVE(_dp) Py_BEGIN_ALLOW_THREADS -#define BSDDB_END_SAVE(_dp) Py_END_ALLOW_THREADS -#endif - -static Py_ssize_t -bsddb_length(bsddbobject *dp) -{ - check_bsddbobject_open(dp, -1); - if (dp->di_size < 0) { - DBT krec, drec; - int status; - int size = 0; - BSDDB_BGN_SAVE(dp) - for (status = (dp->di_bsddb->seq)(dp->di_bsddb, - &krec, &drec,R_FIRST); - status == 0; - status = (dp->di_bsddb->seq)(dp->di_bsddb, - &krec, &drec, R_NEXT)) - size++; - BSDDB_END_SAVE(dp) - if (status < 0) { - PyErr_SetFromErrno(BsddbError); - return -1; - } - dp->di_size = size; - } - return dp->di_size; -} - -static PyObject * -bsddb_subscript(bsddbobject *dp, PyObject *key) -{ - int status; - DBT krec, drec; - char *data,buf[4096]; - int size; - PyObject *result; - recno_t recno; - - if (dp->di_type == DB_RECNO) { - if (!PyArg_Parse(key, "i", &recno)) { - PyErr_SetString(PyExc_TypeError, - "key type must be integer"); - return NULL; - } - krec.data = &recno; - krec.size = sizeof(recno); - } - else { - if (!PyArg_Parse(key, "s#", &data, &size)) { - PyErr_SetString(PyExc_TypeError, - "key type must be string"); - return NULL; - } - krec.data = data; - krec.size = size; - } - check_bsddbobject_open(dp, NULL); - - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->get)(dp->di_bsddb, &krec, &drec, 0); - if (status == 0) { - if (drec.size > sizeof(buf)) data = malloc(drec.size); - else data = buf; - if (data!=NULL) memcpy(data,drec.data,drec.size); - } - BSDDB_END_SAVE(dp) - if (data==NULL) return PyErr_NoMemory(); - if (status != 0) { - if (status < 0) - PyErr_SetFromErrno(BsddbError); - else - PyErr_SetObject(PyExc_KeyError, key); - return NULL; - } - - result = PyString_FromStringAndSize(data, (int)drec.size); - if (data != buf) free(data); - return result; -} - -static int -bsddb_ass_sub(bsddbobject *dp, PyObject *key, PyObject *value) -{ - int status; - DBT krec, drec; - char *data; - int size; - recno_t recno; - - if (dp->di_type == DB_RECNO) { - if (!PyArg_Parse(key, "i", &recno)) { - PyErr_SetString(PyExc_TypeError, - "bsddb key type must be integer"); - return -1; - } - krec.data = &recno; - krec.size = sizeof(recno); - } - else { - if (!PyArg_Parse(key, "s#", &data, &size)) { - PyErr_SetString(PyExc_TypeError, - "bsddb key type must be string"); - return -1; - } - krec.data = data; - krec.size = size; - } - check_bsddbobject_open(dp, -1); - dp->di_size = -1; - if (value == NULL) { - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->del)(dp->di_bsddb, &krec, 0); - BSDDB_END_SAVE(dp) - } - else { - if (!PyArg_Parse(value, "s#", &data, &size)) { - PyErr_SetString(PyExc_TypeError, - "bsddb value type must be string"); - return -1; - } - drec.data = data; - drec.size = size; - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->put)(dp->di_bsddb, &krec, &drec, 0); - BSDDB_END_SAVE(dp) - } - if (status != 0) { - if (status < 0) - PyErr_SetFromErrno(BsddbError); - else - PyErr_SetObject(PyExc_KeyError, key); - return -1; - } - return 0; -} - -static PyMappingMethods bsddb_as_mapping = { - (lenfunc)bsddb_length, /*mp_length*/ - (binaryfunc)bsddb_subscript, /*mp_subscript*/ - (objobjargproc)bsddb_ass_sub, /*mp_ass_subscript*/ -}; - -static PyObject * -bsddb_close(bsddbobject *dp) -{ - if (dp->di_bsddb != NULL) { - int status; - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->close)(dp->di_bsddb); - BSDDB_END_SAVE(dp) - if (status != 0) { - dp->di_bsddb = NULL; - PyErr_SetFromErrno(BsddbError); - return NULL; - } - } - dp->di_bsddb = NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -bsddb_keys(bsddbobject *dp) -{ - PyObject *list, *item=NULL; - DBT krec, drec; - char *data=NULL,buf[4096]; - int status; - int err; - - check_bsddbobject_open(dp, NULL); - list = PyList_New(0); - if (list == NULL) - return NULL; - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->seq)(dp->di_bsddb, &krec, &drec, R_FIRST); - if (status == 0) { - if (krec.size > sizeof(buf)) data = malloc(krec.size); - else data = buf; - if (data != NULL) memcpy(data,krec.data,krec.size); - } - BSDDB_END_SAVE(dp) - if (status == 0 && data==NULL) return PyErr_NoMemory(); - while (status == 0) { - if (dp->di_type == DB_RECNO) - item = PyInt_FromLong(*((int*)data)); - else - item = PyString_FromStringAndSize(data, - (int)krec.size); - if (data != buf) free(data); - if (item == NULL) { - Py_DECREF(list); - return NULL; - } - err = PyList_Append(list, item); - Py_DECREF(item); - if (err != 0) { - Py_DECREF(list); - return NULL; - } - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->seq) - (dp->di_bsddb, &krec, &drec, R_NEXT); - if (status == 0) { - if (krec.size > sizeof(buf)) - data = malloc(krec.size); - else data = buf; - if (data != NULL) - memcpy(data,krec.data,krec.size); - } - BSDDB_END_SAVE(dp) - if (data == NULL) return PyErr_NoMemory(); - } - if (status < 0) { - PyErr_SetFromErrno(BsddbError); - Py_DECREF(list); - return NULL; - } - if (dp->di_size < 0) - dp->di_size = PyList_Size(list); /* We just did the work */ - return list; -} - -static PyObject * -bsddb_contains(bsddbobject *dp, PyObject *args) -{ - DBT krec, drec; - int status; - char *data; - int size; - recno_t recno; - - if (dp->di_type == DB_RECNO) { - if (!PyArg_ParseTuple(args, "i;key type must be integer", - &recno)) { - return NULL; - } - krec.data = &recno; - krec.size = sizeof(recno); - } - else { - if (!PyArg_ParseTuple(args, "s#;key type must be string", - &data, &size)) { - return NULL; - } - krec.data = data; - krec.size = size; - } - check_bsddbobject_open(dp, NULL); - - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->get)(dp->di_bsddb, &krec, &drec, 0); - BSDDB_END_SAVE(dp) - if (status < 0) { - PyErr_SetFromErrno(BsddbError); - return NULL; - } - - return PyInt_FromLong(status == 0); -} - -static PyObject * -bsddb_set_location(bsddbobject *dp, PyObject *key) -{ - int status; - DBT krec, drec; - char *data,buf[4096]; - int size; - PyObject *result; - recno_t recno; - - if (dp->di_type == DB_RECNO) { - if (!PyArg_ParseTuple(key, "i;key type must be integer", - &recno)) { - return NULL; - } - krec.data = &recno; - krec.size = sizeof(recno); - } - else { - if (!PyArg_ParseTuple(key, "s#;key type must be string", - &data, &size)) { - return NULL; - } - krec.data = data; - krec.size = size; - } - check_bsddbobject_open(dp, NULL); - - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->seq)(dp->di_bsddb, &krec, &drec, R_CURSOR); - if (status == 0) { - if (drec.size > sizeof(buf)) data = malloc(drec.size); - else data = buf; - if (data!=NULL) memcpy(data,drec.data,drec.size); - } - BSDDB_END_SAVE(dp) - if (data==NULL) return PyErr_NoMemory(); - if (status != 0) { - if (status < 0) - PyErr_SetFromErrno(BsddbError); - else - PyErr_SetObject(PyExc_KeyError, key); - return NULL; - } - - if (dp->di_type == DB_RECNO) - result = Py_BuildValue("is#", *((int*)krec.data), - data, drec.size); - else - result = Py_BuildValue("s#s#", krec.data, krec.size, - data, drec.size); - if (data != buf) free(data); - return result; -} - -static PyObject * -bsddb_seq(bsddbobject *dp, int sequence_request) -{ - int status; - DBT krec, drec; - char *kdata=NULL,kbuf[4096]; - char *ddata=NULL,dbuf[4096]; - PyObject *result; - - check_bsddbobject_open(dp, NULL); - krec.data = 0; - krec.size = 0; - - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->seq)(dp->di_bsddb, &krec, - &drec, sequence_request); - if (status == 0) { - if (krec.size > sizeof(kbuf)) kdata = malloc(krec.size); - else kdata = kbuf; - if (kdata != NULL) memcpy(kdata,krec.data,krec.size); - if (drec.size > sizeof(dbuf)) ddata = malloc(drec.size); - else ddata = dbuf; - if (ddata != NULL) memcpy(ddata,drec.data,drec.size); - } - BSDDB_END_SAVE(dp) - if (status == 0) { - if ((kdata == NULL) || (ddata == NULL)) - return PyErr_NoMemory(); - } - else { - /* (status != 0) */ - if (status < 0) - PyErr_SetFromErrno(BsddbError); - else - PyErr_SetString(PyExc_KeyError, "no key/data pairs"); - return NULL; - } - - if (dp->di_type == DB_RECNO) - result = Py_BuildValue("is#", *((int*)kdata), - ddata, drec.size); - else - result = Py_BuildValue("s#s#", kdata, krec.size, - ddata, drec.size); - if (kdata != kbuf) free(kdata); - if (ddata != dbuf) free(ddata); - return result; -} - -static PyObject * -bsddb_next(bsddbobject *dp) -{ - return bsddb_seq(dp, R_NEXT); -} -static PyObject * -bsddb_previous(bsddbobject *dp) -{ - return bsddb_seq(dp, R_PREV); -} -static PyObject * -bsddb_first(bsddbobject *dp) -{ - return bsddb_seq(dp, R_FIRST); -} -static PyObject * -bsddb_last(bsddbobject *dp) -{ - return bsddb_seq(dp, R_LAST); -} -static PyObject * -bsddb_sync(bsddbobject *dp) -{ - int status; - - check_bsddbobject_open(dp, NULL); - BSDDB_BGN_SAVE(dp) - status = (dp->di_bsddb->sync)(dp->di_bsddb, 0); - BSDDB_END_SAVE(dp) - if (status != 0) { - PyErr_SetFromErrno(BsddbError); - return NULL; - } - return PyInt_FromLong(status = 0); -} -static PyMethodDef bsddb_methods[] = { - {"close", (PyCFunction)bsddb_close, METH_NOARGS}, - {"keys", (PyCFunction)bsddb_keys, METH_NOARGS}, - {"__contains__", (PyCFunction)bsddb_contains, METH_VARARGS}, - {"set_location", (PyCFunction)bsddb_set_location, METH_VARARGS}, - {"next", (PyCFunction)bsddb_next, METH_NOARGS}, - {"previous", (PyCFunction)bsddb_previous, METH_NOARGS}, - {"first", (PyCFunction)bsddb_first, METH_NOARGS}, - {"last", (PyCFunction)bsddb_last, METH_NOARGS}, - {"sync", (PyCFunction)bsddb_sync, METH_NOARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -bsddb_getattr(PyObject *dp, char *name) -{ - return Py_FindMethod(bsddb_methods, dp, name); -} - -static PyTypeObject Bsddbtype = { - PyObject_HEAD_INIT(NULL) - 0, - "bsddb.bsddb", - sizeof(bsddbobject), - 0, - (destructor)bsddb_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)bsddb_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - &bsddb_as_mapping, /*tp_as_mapping*/ -}; - -static PyObject * -bsdhashopen(PyObject *self, PyObject *args) -{ - char *file; - char *flag = NULL; - int flags = O_RDONLY; - int mode = 0666; - int bsize = 0; - int ffactor = 0; - int nelem = 0; - int cachesize = 0; - int hash = 0; /* XXX currently ignored */ - int lorder = 0; - - if (!PyArg_ParseTuple(args, "z|siiiiiii:hashopen", - &file, &flag, &mode, - &bsize, &ffactor, &nelem, &cachesize, - &hash, &lorder)) - return NULL; - if (flag != NULL) { - /* XXX need to pass O_EXCL, O_EXLOCK, O_NONBLOCK, O_SHLOCK */ - if (flag[0] == 'r') - flags = O_RDONLY; - else if (flag[0] == 'w') - flags = O_RDWR; - else if (flag[0] == 'c') - flags = O_RDWR|O_CREAT; - else if (flag[0] == 'n') - flags = O_RDWR|O_CREAT|O_TRUNC; - else { - PyErr_SetString(BsddbError, - "Flag should begin with 'r', 'w', 'c' or 'n'"); - return NULL; - } - if (flag[1] == 'l') { -#if defined(O_EXLOCK) && defined(O_SHLOCK) - if (flag[0] == 'r') - flags |= O_SHLOCK; - else - flags |= O_EXLOCK; -#else - PyErr_SetString(BsddbError, - "locking not supported on this platform"); - return NULL; -#endif - } - } - return newdbhashobject(file, flags, mode, - bsize, ffactor, nelem, cachesize, hash, lorder); -} - -static PyObject * -bsdbtopen(PyObject *self, PyObject *args) -{ - char *file; - char *flag = NULL; - int flags = O_RDONLY; - int mode = 0666; - int cachesize = 0; - int maxkeypage = 0; - int minkeypage = 0; - int btflags = 0; - unsigned int psize = 0; - int lorder = 0; - - if (!PyArg_ParseTuple(args, "z|siiiiiii:btopen", - &file, &flag, &mode, - &btflags, &cachesize, &maxkeypage, &minkeypage, - &psize, &lorder)) - return NULL; - if (flag != NULL) { - /* XXX need to pass O_EXCL, O_EXLOCK, O_NONBLOCK, O_SHLOCK */ - if (flag[0] == 'r') - flags = O_RDONLY; - else if (flag[0] == 'w') - flags = O_RDWR; - else if (flag[0] == 'c') - flags = O_RDWR|O_CREAT; - else if (flag[0] == 'n') - flags = O_RDWR|O_CREAT|O_TRUNC; - else { - PyErr_SetString(BsddbError, - "Flag should begin with 'r', 'w', 'c' or 'n'"); - return NULL; - } - if (flag[1] == 'l') { -#if defined(O_EXLOCK) && defined(O_SHLOCK) - if (flag[0] == 'r') - flags |= O_SHLOCK; - else - flags |= O_EXLOCK; -#else - PyErr_SetString(BsddbError, - "locking not supported on this platform"); - return NULL; -#endif - } - } - return newdbbtobject(file, flags, mode, - btflags, cachesize, maxkeypage, minkeypage, - psize, lorder); -} - -static PyObject * -bsdrnopen(PyObject *self, PyObject *args) -{ - char *file; - char *flag = NULL; - int flags = O_RDONLY; - int mode = 0666; - int cachesize = 0; - int rnflags = 0; - unsigned int psize = 0; - int lorder = 0; - size_t reclen = 0; - char *bval = ""; - char *bfname = NULL; - - if (!PyArg_ParseTuple(args, "z|siiiiiiss:rnopen", - &file, &flag, &mode, - &rnflags, &cachesize, &psize, &lorder, - &reclen, &bval, &bfname)) - return NULL; - - if (flag != NULL) { - /* XXX need to pass O_EXCL, O_EXLOCK, O_NONBLOCK, O_SHLOCK */ - if (flag[0] == 'r') - flags = O_RDONLY; - else if (flag[0] == 'w') - flags = O_RDWR; - else if (flag[0] == 'c') - flags = O_RDWR|O_CREAT; - else if (flag[0] == 'n') - flags = O_RDWR|O_CREAT|O_TRUNC; - else { - PyErr_SetString(BsddbError, - "Flag should begin with 'r', 'w', 'c' or 'n'"); - return NULL; - } - if (flag[1] == 'l') { -#if defined(O_EXLOCK) && defined(O_SHLOCK) - if (flag[0] == 'r') - flags |= O_SHLOCK; - else - flags |= O_EXLOCK; -#else - PyErr_SetString(BsddbError, - "locking not supported on this platform"); - return NULL; -#endif - } - else if (flag[1] != '\0') { - PyErr_SetString(BsddbError, - "Flag char 2 should be 'l' or absent"); - return NULL; - } - } - return newdbrnobject(file, flags, mode, rnflags, cachesize, - psize, lorder, reclen, bval[0], bfname); -} - -static PyMethodDef bsddbmodule_methods[] = { - {"hashopen", (PyCFunction)bsdhashopen, METH_VARARGS}, - {"btopen", (PyCFunction)bsdbtopen, METH_VARARGS}, - {"rnopen", (PyCFunction)bsdrnopen, METH_VARARGS}, - /* strictly for use by dbhhash!!! */ - {"open", (PyCFunction)bsdhashopen, METH_VARARGS}, - {0, 0}, -}; - -PyMODINIT_FUNC -initbsddb185(void) { - PyObject *m, *d; - - Bsddbtype.ob_type = &PyType_Type; - m = Py_InitModule("bsddb185", bsddbmodule_methods); - if (m == NULL) - return; - d = PyModule_GetDict(m); - BsddbError = PyErr_NewException("bsddb.error", NULL, NULL); - if (BsddbError != NULL) - PyDict_SetItemString(d, "error", BsddbError); -} diff --git a/Modules/cdmodule.c b/Modules/cdmodule.c deleted file mode 100644 index f8efd39..0000000 --- a/Modules/cdmodule.c +++ /dev/null @@ -1,796 +0,0 @@ -/* CD module -- interface to Mark Callow's and Roger Chickering's */ - /* CD Audio Library (CD). */ - -#include <sys/types.h> -#include <cdaudio.h> -#include "Python.h" - -#define NCALLBACKS 8 - -typedef struct { - PyObject_HEAD - CDPLAYER *ob_cdplayer; -} cdplayerobject; - -static PyObject *CdError; /* exception cd.error */ - -static PyObject * -CD_allowremoval(cdplayerobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":allowremoval")) - return NULL; - - CDallowremoval(self->ob_cdplayer); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_preventremoval(cdplayerobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":preventremoval")) - return NULL; - - CDpreventremoval(self->ob_cdplayer); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_bestreadsize(cdplayerobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":bestreadsize")) - return NULL; - - return PyInt_FromLong((long) CDbestreadsize(self->ob_cdplayer)); -} - -static PyObject * -CD_close(cdplayerobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":close")) - return NULL; - - if (!CDclose(self->ob_cdplayer)) { - PyErr_SetFromErrno(CdError); /* XXX - ??? */ - return NULL; - } - self->ob_cdplayer = NULL; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_eject(cdplayerobject *self, PyObject *args) -{ - CDSTATUS status; - - if (!PyArg_ParseTuple(args, ":eject")) - return NULL; - - if (!CDeject(self->ob_cdplayer)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "eject failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_getstatus(cdplayerobject *self, PyObject *args) -{ - CDSTATUS status; - - if (!PyArg_ParseTuple(args, ":getstatus")) - return NULL; - - if (!CDgetstatus(self->ob_cdplayer, &status)) { - PyErr_SetFromErrno(CdError); /* XXX - ??? */ - return NULL; - } - - return Py_BuildValue("(ii(iii)(iii)(iii)iiii)", status.state, - status.track, status.min, status.sec, status.frame, - status.abs_min, status.abs_sec, status.abs_frame, - status.total_min, status.total_sec, status.total_frame, - status.first, status.last, status.scsi_audio, - status.cur_block); -} - -static PyObject * -CD_gettrackinfo(cdplayerobject *self, PyObject *args) -{ - int track; - CDTRACKINFO info; - CDSTATUS status; - - if (!PyArg_ParseTuple(args, "i:gettrackinfo", &track)) - return NULL; - - if (!CDgettrackinfo(self->ob_cdplayer, track, &info)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "gettrackinfo failed"); - return NULL; - } - - return Py_BuildValue("((iii)(iii))", - info.start_min, info.start_sec, info.start_frame, - info.total_min, info.total_sec, info.total_frame); -} - -static PyObject * -CD_msftoblock(cdplayerobject *self, PyObject *args) -{ - int min, sec, frame; - - if (!PyArg_ParseTuple(args, "iii:msftoblock", &min, &sec, &frame)) - return NULL; - - return PyInt_FromLong((long) CDmsftoblock(self->ob_cdplayer, - min, sec, frame)); -} - -static PyObject * -CD_play(cdplayerobject *self, PyObject *args) -{ - int start, play; - CDSTATUS status; - - if (!PyArg_ParseTuple(args, "ii:play", &start, &play)) - return NULL; - - if (!CDplay(self->ob_cdplayer, start, play)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "play failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_playabs(cdplayerobject *self, PyObject *args) -{ - int min, sec, frame, play; - CDSTATUS status; - - if (!PyArg_ParseTuple(args, "iiii:playabs", &min, &sec, &frame, &play)) - return NULL; - - if (!CDplayabs(self->ob_cdplayer, min, sec, frame, play)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "playabs failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_playtrack(cdplayerobject *self, PyObject *args) -{ - int start, play; - CDSTATUS status; - - if (!PyArg_ParseTuple(args, "ii:playtrack", &start, &play)) - return NULL; - - if (!CDplaytrack(self->ob_cdplayer, start, play)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "playtrack failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_playtrackabs(cdplayerobject *self, PyObject *args) -{ - int track, min, sec, frame, play; - CDSTATUS status; - - if (!PyArg_ParseTuple(args, "iiiii:playtrackabs", &track, &min, &sec, - &frame, &play)) - return NULL; - - if (!CDplaytrackabs(self->ob_cdplayer, track, min, sec, frame, play)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "playtrackabs failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_readda(cdplayerobject *self, PyObject *args) -{ - int numframes, n; - PyObject *result; - - if (!PyArg_ParseTuple(args, "i:readda", &numframes)) - return NULL; - - result = PyString_FromStringAndSize(NULL, numframes * sizeof(CDFRAME)); - if (result == NULL) - return NULL; - - n = CDreadda(self->ob_cdplayer, - (CDFRAME *) PyString_AsString(result), numframes); - if (n == -1) { - Py_DECREF(result); - PyErr_SetFromErrno(CdError); - return NULL; - } - if (n < numframes) - _PyString_Resize(&result, n * sizeof(CDFRAME)); - - return result; -} - -static PyObject * -CD_seek(cdplayerobject *self, PyObject *args) -{ - int min, sec, frame; - long PyTryBlock; - - if (!PyArg_ParseTuple(args, "iii:seek", &min, &sec, &frame)) - return NULL; - - PyTryBlock = CDseek(self->ob_cdplayer, min, sec, frame); - if (PyTryBlock == -1) { - PyErr_SetFromErrno(CdError); - return NULL; - } - - return PyInt_FromLong(PyTryBlock); -} - -static PyObject * -CD_seektrack(cdplayerobject *self, PyObject *args) -{ - int track; - long PyTryBlock; - - if (!PyArg_ParseTuple(args, "i:seektrack", &track)) - return NULL; - - PyTryBlock = CDseektrack(self->ob_cdplayer, track); - if (PyTryBlock == -1) { - PyErr_SetFromErrno(CdError); - return NULL; - } - - return PyInt_FromLong(PyTryBlock); -} - -static PyObject * -CD_seekblock(cdplayerobject *self, PyObject *args) -{ - unsigned long PyTryBlock; - - if (!PyArg_ParseTuple(args, "l:seekblock", &PyTryBlock)) - return NULL; - - PyTryBlock = CDseekblock(self->ob_cdplayer, PyTryBlock); - if (PyTryBlock == (unsigned long) -1) { - PyErr_SetFromErrno(CdError); - return NULL; - } - - return PyInt_FromLong(PyTryBlock); -} - -static PyObject * -CD_stop(cdplayerobject *self, PyObject *args) -{ - CDSTATUS status; - - if (!PyArg_ParseTuple(args, ":stop")) - return NULL; - - if (!CDstop(self->ob_cdplayer)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "stop failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_togglepause(cdplayerobject *self, PyObject *args) -{ - CDSTATUS status; - - if (!PyArg_ParseTuple(args, ":togglepause")) - return NULL; - - if (!CDtogglepause(self->ob_cdplayer)) { - if (CDgetstatus(self->ob_cdplayer, &status) && - status.state == CD_NODISC) - PyErr_SetString(CdError, "no disc in player"); - else - PyErr_SetString(CdError, "togglepause failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyMethodDef cdplayer_methods[] = { - {"allowremoval", (PyCFunction)CD_allowremoval, METH_VARARGS}, - {"bestreadsize", (PyCFunction)CD_bestreadsize, METH_VARARGS}, - {"close", (PyCFunction)CD_close, METH_VARARGS}, - {"eject", (PyCFunction)CD_eject, METH_VARARGS}, - {"getstatus", (PyCFunction)CD_getstatus, METH_VARARGS}, - {"gettrackinfo", (PyCFunction)CD_gettrackinfo, METH_VARARGS}, - {"msftoblock", (PyCFunction)CD_msftoblock, METH_VARARGS}, - {"play", (PyCFunction)CD_play, METH_VARARGS}, - {"playabs", (PyCFunction)CD_playabs, METH_VARARGS}, - {"playtrack", (PyCFunction)CD_playtrack, METH_VARARGS}, - {"playtrackabs", (PyCFunction)CD_playtrackabs, METH_VARARGS}, - {"preventremoval", (PyCFunction)CD_preventremoval, METH_VARARGS}, - {"readda", (PyCFunction)CD_readda, METH_VARARGS}, - {"seek", (PyCFunction)CD_seek, METH_VARARGS}, - {"seekblock", (PyCFunction)CD_seekblock, METH_VARARGS}, - {"seektrack", (PyCFunction)CD_seektrack, METH_VARARGS}, - {"stop", (PyCFunction)CD_stop, METH_VARARGS}, - {"togglepause", (PyCFunction)CD_togglepause, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - -static void -cdplayer_dealloc(cdplayerobject *self) -{ - if (self->ob_cdplayer != NULL) - CDclose(self->ob_cdplayer); - PyObject_Del(self); -} - -static PyObject * -cdplayer_getattr(cdplayerobject *self, char *name) -{ - if (self->ob_cdplayer == NULL) { - PyErr_SetString(PyExc_RuntimeError, "no player active"); - return NULL; - } - return Py_FindMethod(cdplayer_methods, (PyObject *)self, name); -} - -PyTypeObject CdPlayertype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "cd.cdplayer", /*tp_name*/ - sizeof(cdplayerobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)cdplayer_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)cdplayer_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ -}; - -static PyObject * -newcdplayerobject(CDPLAYER *cdp) -{ - cdplayerobject *p; - - p = PyObject_New(cdplayerobject, &CdPlayertype); - if (p == NULL) - return NULL; - p->ob_cdplayer = cdp; - return (PyObject *) p; -} - -static PyObject * -CD_open(PyObject *self, PyObject *args) -{ - char *dev, *direction; - CDPLAYER *cdp; - - /* - * Variable number of args. - * First defaults to "None", second defaults to "r". - */ - dev = NULL; - direction = "r"; - if (!PyArg_ParseTuple(args, "|zs:open", &dev, &direction)) - return NULL; - - cdp = CDopen(dev, direction); - if (cdp == NULL) { - PyErr_SetFromErrno(CdError); - return NULL; - } - - return newcdplayerobject(cdp); -} - -typedef struct { - PyObject_HEAD - CDPARSER *ob_cdparser; - struct { - PyObject *ob_cdcallback; - PyObject *ob_cdcallbackarg; - } ob_cdcallbacks[NCALLBACKS]; -} cdparserobject; - -static void -CD_callback(void *arg, CDDATATYPES type, void *data) -{ - PyObject *result, *args, *v = NULL; - char *p; - int i; - cdparserobject *self; - - self = (cdparserobject *) arg; - args = PyTuple_New(3); - if (args == NULL) - return; - Py_INCREF(self->ob_cdcallbacks[type].ob_cdcallbackarg); - PyTuple_SetItem(args, 0, self->ob_cdcallbacks[type].ob_cdcallbackarg); - PyTuple_SetItem(args, 1, PyInt_FromLong((long) type)); - switch (type) { - case cd_audio: - v = PyString_FromStringAndSize(data, CDDA_DATASIZE); - break; - case cd_pnum: - case cd_index: - v = PyInt_FromLong(((CDPROGNUM *) data)->value); - break; - case cd_ptime: - case cd_atime: -#define ptr ((struct cdtimecode *) data) - v = Py_BuildValue("(iii)", - ptr->mhi * 10 + ptr->mlo, - ptr->shi * 10 + ptr->slo, - ptr->fhi * 10 + ptr->flo); -#undef ptr - break; - case cd_catalog: - v = PyString_FromStringAndSize(NULL, 13); - p = PyString_AsString(v); - for (i = 0; i < 13; i++) - *p++ = ((char *) data)[i] + '0'; - break; - case cd_ident: -#define ptr ((struct cdident *) data) - v = PyString_FromStringAndSize(NULL, 12); - p = PyString_AsString(v); - CDsbtoa(p, ptr->country, 2); - p += 2; - CDsbtoa(p, ptr->owner, 3); - p += 3; - *p++ = ptr->year[0] + '0'; - *p++ = ptr->year[1] + '0'; - *p++ = ptr->serial[0] + '0'; - *p++ = ptr->serial[1] + '0'; - *p++ = ptr->serial[2] + '0'; - *p++ = ptr->serial[3] + '0'; - *p++ = ptr->serial[4] + '0'; -#undef ptr - break; - case cd_control: - v = PyInt_FromLong((long) *((unchar *) data)); - break; - } - PyTuple_SetItem(args, 2, v); - if (PyErr_Occurred()) { - Py_DECREF(args); - return; - } - - result = PyEval_CallObject(self->ob_cdcallbacks[type].ob_cdcallback, - args); - Py_DECREF(args); - Py_XDECREF(result); -} - -static PyObject * -CD_deleteparser(cdparserobject *self, PyObject *args) -{ - int i; - - if (!PyArg_ParseTuple(args, ":deleteparser")) - return NULL; - - CDdeleteparser(self->ob_cdparser); - self->ob_cdparser = NULL; - - /* no sense in keeping the callbacks, so remove them */ - for (i = 0; i < NCALLBACKS; i++) { - Py_XDECREF(self->ob_cdcallbacks[i].ob_cdcallback); - self->ob_cdcallbacks[i].ob_cdcallback = NULL; - Py_XDECREF(self->ob_cdcallbacks[i].ob_cdcallbackarg); - self->ob_cdcallbacks[i].ob_cdcallbackarg = NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_parseframe(cdparserobject *self, PyObject *args) -{ - char *cdfp; - int length; - CDFRAME *p; - - if (!PyArg_ParseTuple(args, "s#:parseframe", &cdfp, &length)) - return NULL; - - if (length % sizeof(CDFRAME) != 0) { - PyErr_SetString(PyExc_TypeError, "bad length"); - return NULL; - } - - p = (CDFRAME *) cdfp; - while (length > 0) { - CDparseframe(self->ob_cdparser, p); - length -= sizeof(CDFRAME); - p++; - if (PyErr_Occurred()) - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_removecallback(cdparserobject *self, PyObject *args) -{ - int type; - - if (!PyArg_ParseTuple(args, "i:removecallback", &type)) - return NULL; - - if (type < 0 || type >= NCALLBACKS) { - PyErr_SetString(PyExc_TypeError, "bad type"); - return NULL; - } - - CDremovecallback(self->ob_cdparser, (CDDATATYPES) type); - - Py_XDECREF(self->ob_cdcallbacks[type].ob_cdcallback); - self->ob_cdcallbacks[type].ob_cdcallback = NULL; - - Py_XDECREF(self->ob_cdcallbacks[type].ob_cdcallbackarg); - self->ob_cdcallbacks[type].ob_cdcallbackarg = NULL; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_resetparser(cdparserobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":resetparser")) - return NULL; - - CDresetparser(self->ob_cdparser); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -CD_addcallback(cdparserobject *self, PyObject *args) -{ - int type; - PyObject *func, *funcarg; - - /* XXX - more work here */ - if (!PyArg_ParseTuple(args, "iOO:addcallback", &type, &func, &funcarg)) - return NULL; - - if (type < 0 || type >= NCALLBACKS) { - PyErr_SetString(PyExc_TypeError, "argument out of range"); - return NULL; - } - -#ifdef CDsetcallback - CDaddcallback(self->ob_cdparser, (CDDATATYPES) type, CD_callback, - (void *) self); -#else - CDsetcallback(self->ob_cdparser, (CDDATATYPES) type, CD_callback, - (void *) self); -#endif - Py_XDECREF(self->ob_cdcallbacks[type].ob_cdcallback); - Py_INCREF(func); - self->ob_cdcallbacks[type].ob_cdcallback = func; - Py_XDECREF(self->ob_cdcallbacks[type].ob_cdcallbackarg); - Py_INCREF(funcarg); - self->ob_cdcallbacks[type].ob_cdcallbackarg = funcarg; - -/* - if (type == cd_audio) { - sigfpe_[_UNDERFL].repls = _ZERO; - handle_sigfpes(_ON, _EN_UNDERFL, NULL, - _ABORT_ON_ERROR, NULL); - } -*/ - - Py_INCREF(Py_None); - return Py_None; -} - -static PyMethodDef cdparser_methods[] = { - {"addcallback", (PyCFunction)CD_addcallback, METH_VARARGS}, - {"deleteparser", (PyCFunction)CD_deleteparser, METH_VARARGS}, - {"parseframe", (PyCFunction)CD_parseframe, METH_VARARGS}, - {"removecallback", (PyCFunction)CD_removecallback, METH_VARARGS}, - {"resetparser", (PyCFunction)CD_resetparser, METH_VARARGS}, - /* backward compatibility */ - {"setcallback", (PyCFunction)CD_addcallback, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - -static void -cdparser_dealloc(cdparserobject *self) -{ - int i; - - for (i = 0; i < NCALLBACKS; i++) { - Py_XDECREF(self->ob_cdcallbacks[i].ob_cdcallback); - self->ob_cdcallbacks[i].ob_cdcallback = NULL; - Py_XDECREF(self->ob_cdcallbacks[i].ob_cdcallbackarg); - self->ob_cdcallbacks[i].ob_cdcallbackarg = NULL; - } - CDdeleteparser(self->ob_cdparser); - PyObject_Del(self); -} - -static PyObject * -cdparser_getattr(cdparserobject *self, char *name) -{ - if (self->ob_cdparser == NULL) { - PyErr_SetString(PyExc_RuntimeError, "no parser active"); - return NULL; - } - - return Py_FindMethod(cdparser_methods, (PyObject *)self, name); -} - -PyTypeObject CdParsertype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "cd.cdparser", /*tp_name*/ - sizeof(cdparserobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)cdparser_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)cdparser_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ -}; - -static PyObject * -newcdparserobject(CDPARSER *cdp) -{ - cdparserobject *p; - int i; - - p = PyObject_New(cdparserobject, &CdParsertype); - if (p == NULL) - return NULL; - p->ob_cdparser = cdp; - for (i = 0; i < NCALLBACKS; i++) { - p->ob_cdcallbacks[i].ob_cdcallback = NULL; - p->ob_cdcallbacks[i].ob_cdcallbackarg = NULL; - } - return (PyObject *) p; -} - -static PyObject * -CD_createparser(PyObject *self, PyObject *args) -{ - CDPARSER *cdp; - - if (!PyArg_ParseTuple(args, ":createparser")) - return NULL; - cdp = CDcreateparser(); - if (cdp == NULL) { - PyErr_SetString(CdError, "createparser failed"); - return NULL; - } - - return newcdparserobject(cdp); -} - -static PyObject * -CD_msftoframe(PyObject *self, PyObject *args) -{ - int min, sec, frame; - - if (!PyArg_ParseTuple(args, "iii:msftoframe", &min, &sec, &frame)) - return NULL; - - return PyInt_FromLong((long) CDmsftoframe(min, sec, frame)); -} - -static PyMethodDef CD_methods[] = { - {"open", (PyCFunction)CD_open, METH_VARARGS}, - {"createparser", (PyCFunction)CD_createparser, METH_VARARGS}, - {"msftoframe", (PyCFunction)CD_msftoframe, METH_VARARGS}, - {NULL, NULL} /* Sentinel */ -}; - -void -initcd(void) -{ - PyObject *m, *d; - - m = Py_InitModule("cd", CD_methods); - if (m == NULL) - return; - d = PyModule_GetDict(m); - - CdError = PyErr_NewException("cd.error", NULL, NULL); - PyDict_SetItemString(d, "error", CdError); - - /* Identifiers for the different types of callbacks from the parser */ - PyDict_SetItemString(d, "audio", PyInt_FromLong((long) cd_audio)); - PyDict_SetItemString(d, "pnum", PyInt_FromLong((long) cd_pnum)); - PyDict_SetItemString(d, "index", PyInt_FromLong((long) cd_index)); - PyDict_SetItemString(d, "ptime", PyInt_FromLong((long) cd_ptime)); - PyDict_SetItemString(d, "atime", PyInt_FromLong((long) cd_atime)); - PyDict_SetItemString(d, "catalog", PyInt_FromLong((long) cd_catalog)); - PyDict_SetItemString(d, "ident", PyInt_FromLong((long) cd_ident)); - PyDict_SetItemString(d, "control", PyInt_FromLong((long) cd_control)); - - /* Block size information for digital audio data */ - PyDict_SetItemString(d, "DATASIZE", - PyInt_FromLong((long) CDDA_DATASIZE)); - PyDict_SetItemString(d, "BLOCKSIZE", - PyInt_FromLong((long) CDDA_BLOCKSIZE)); - - /* Possible states for the cd player */ - PyDict_SetItemString(d, "ERROR", PyInt_FromLong((long) CD_ERROR)); - PyDict_SetItemString(d, "NODISC", PyInt_FromLong((long) CD_NODISC)); - PyDict_SetItemString(d, "READY", PyInt_FromLong((long) CD_READY)); - PyDict_SetItemString(d, "PLAYING", PyInt_FromLong((long) CD_PLAYING)); - PyDict_SetItemString(d, "PAUSED", PyInt_FromLong((long) CD_PAUSED)); - PyDict_SetItemString(d, "STILL", PyInt_FromLong((long) CD_STILL)); -#ifdef CD_CDROM /* only newer versions of the library */ - PyDict_SetItemString(d, "CDROM", PyInt_FromLong((long) CD_CDROM)); -#endif -} diff --git a/Modules/cgen.py b/Modules/cgen.py deleted file mode 100644 index 93c21b1..0000000 --- a/Modules/cgen.py +++ /dev/null @@ -1,520 +0,0 @@ -######################################################################## -# Copyright (c) 2000, BeOpen.com. -# Copyright (c) 1995-2000, Corporation for National Research Initiatives. -# Copyright (c) 1990-1995, Stichting Mathematisch Centrum. -# All rights reserved. -# -# See the file "Misc/COPYRIGHT" for information on usage and -# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. -######################################################################## - -# Python script to parse cstubs file for gl and generate C stubs. -# usage: python cgen.py <cstubs >glmodule.c -# -# NOTE: You must first make a python binary without the "GL" option -# before you can run this, when building Python for the first time. -# See comments in the Makefile. -# -# XXX BUG return arrays generate wrong code -# XXX need to change error returns into gotos to free mallocked arrays - - -import string -import sys - - -# Function to print to stderr -# -def err(*args): - savestdout = sys.stdout - try: - sys.stdout = sys.stderr - for i in args: - print i, - print - finally: - sys.stdout = savestdout - - -# The set of digits that form a number -# -digits = '0123456789' - - -# Function to extract a string of digits from the front of the string. -# Returns the leading string of digits and the remaining string. -# If no number is found, returns '' and the original string. -# -def getnum(s): - n = '' - while s and s[0] in digits: - n = n + s[0] - s = s[1:] - return n, s - - -# Function to check if a string is a number -# -def isnum(s): - if not s: return False - for c in s: - if not c in digits: return False - return True - - -# Allowed function return types -# -return_types = ['void', 'short', 'long'] - - -# Allowed function argument types -# -arg_types = ['char', 'string', 'short', 'u_short', 'float', 'long', 'double'] - - -# Need to classify arguments as follows -# simple input variable -# simple output variable -# input array -# output array -# input giving size of some array -# -# Array dimensions can be specified as follows -# constant -# argN -# constant * argN -# retval -# constant * retval -# -# The dimensions given as constants * something are really -# arrays of points where points are 2- 3- or 4-tuples -# -# We have to consider three lists: -# python input arguments -# C stub arguments (in & out) -# python output arguments (really return values) -# -# There is a mapping from python input arguments to the input arguments -# of the C stub, and a further mapping from C stub arguments to the -# python return values - - -# Exception raised by checkarg() and generate() -# -arg_error = 'bad arg' - - -# Function to check one argument. -# Arguments: the type and the arg "name" (really mode plus subscript). -# Raises arg_error if something's wrong. -# Return type, mode, factor, rest of subscript; factor and rest may be empty. -# -def checkarg(type, arg): - # - # Turn "char *x" into "string x". - # - if type == 'char' and arg[0] == '*': - type = 'string' - arg = arg[1:] - # - # Check that the type is supported. - # - if type not in arg_types: - raise arg_error, ('bad type', type) - if type[:2] == 'u_': - type = 'unsigned ' + type[2:] - # - # Split it in the mode (first character) and the rest. - # - mode, rest = arg[:1], arg[1:] - # - # The mode must be 's' for send (= input) or 'r' for return argument. - # - if mode not in ('r', 's'): - raise arg_error, ('bad arg mode', mode) - # - # Is it a simple argument: if so, we are done. - # - if not rest: - return type, mode, '', '' - # - # Not a simple argument; must be an array. - # The 'rest' must be a subscript enclosed in [ and ]. - # The subscript must be one of the following forms, - # otherwise we don't handle it (where N is a number): - # N - # argN - # retval - # N*argN - # N*retval - # - if rest[:1] != '[' or rest[-1:] != ']': - raise arg_error, ('subscript expected', rest) - sub = rest[1:-1] - # - # Is there a leading number? - # - num, sub = getnum(sub) - if num: - # There is a leading number - if not sub: - # The subscript is just a number - return type, mode, num, '' - if sub[:1] == '*': - # There is a factor prefix - sub = sub[1:] - else: - raise arg_error, ('\'*\' expected', sub) - if sub == 'retval': - # size is retval -- must be a reply argument - if mode != 'r': - raise arg_error, ('non-r mode with [retval]', mode) - elif not isnum(sub) and (sub[:3] != 'arg' or not isnum(sub[3:])): - raise arg_error, ('bad subscript', sub) - # - return type, mode, num, sub - - -# List of functions for which we have generated stubs -# -functions = [] - - -# Generate the stub for the given function, using the database of argument -# information build by successive calls to checkarg() -# -def generate(type, func, database): - # - # Check that we can handle this case: - # no variable size reply arrays yet - # - n_in_args = 0 - n_out_args = 0 - # - for a_type, a_mode, a_factor, a_sub in database: - if a_mode == 's': - n_in_args = n_in_args + 1 - elif a_mode == 'r': - n_out_args = n_out_args + 1 - else: - # Can't happen - raise arg_error, ('bad a_mode', a_mode) - if (a_mode == 'r' and a_sub) or a_sub == 'retval': - err('Function', func, 'too complicated:', - a_type, a_mode, a_factor, a_sub) - print '/* XXX Too complicated to generate code for */' - return - # - functions.append(func) - # - # Stub header - # - print - print 'static PyObject *' - print 'gl_' + func + '(self, args)' - print '\tPyObject *self;' - print '\tPyObject *args;' - print '{' - # - # Declare return value if any - # - if type != 'void': - print '\t' + type, 'retval;' - # - # Declare arguments - # - for i in range(len(database)): - a_type, a_mode, a_factor, a_sub = database[i] - print '\t' + a_type, - brac = ket = '' - if a_sub and not isnum(a_sub): - if a_factor: - brac = '(' - ket = ')' - print brac + '*', - print 'arg' + repr(i+1) + ket, - if a_sub and isnum(a_sub): - print '[', a_sub, ']', - if a_factor: - print '[', a_factor, ']', - print ';' - # - # Find input arguments derived from array sizes - # - for i in range(len(database)): - a_type, a_mode, a_factor, a_sub = database[i] - if a_mode == 's' and a_sub[:3] == 'arg' and isnum(a_sub[3:]): - # Sending a variable-length array - n = eval(a_sub[3:]) - if 1 <= n <= len(database): - b_type, b_mode, b_factor, b_sub = database[n-1] - if b_mode == 's': - database[n-1] = b_type, 'i', a_factor, repr(i) - n_in_args = n_in_args - 1 - # - # Assign argument positions in the Python argument list - # - in_pos = [] - i_in = 0 - for i in range(len(database)): - a_type, a_mode, a_factor, a_sub = database[i] - if a_mode == 's': - in_pos.append(i_in) - i_in = i_in + 1 - else: - in_pos.append(-1) - # - # Get input arguments - # - for i in range(len(database)): - a_type, a_mode, a_factor, a_sub = database[i] - if a_type[:9] == 'unsigned ': - xtype = a_type[9:] - else: - xtype = a_type - if a_mode == 'i': - # - # Implicit argument; - # a_factor is divisor if present, - # a_sub indicates which arg (`database index`) - # - j = eval(a_sub) - print '\tif', - print '(!geti' + xtype + 'arraysize(args,', - print repr(n_in_args) + ',', - print repr(in_pos[j]) + ',', - if xtype != a_type: - print '('+xtype+' *)', - print '&arg' + repr(i+1) + '))' - print '\t\treturn NULL;' - if a_factor: - print '\targ' + repr(i+1), - print '= arg' + repr(i+1), - print '/', a_factor + ';' - elif a_mode == 's': - if a_sub and not isnum(a_sub): - # Allocate memory for varsize array - print '\tif ((arg' + repr(i+1), '=', - if a_factor: - print '('+a_type+'(*)['+a_factor+'])', - print 'PyMem_NEW(' + a_type, ',', - if a_factor: - print a_factor, '*', - print a_sub, ')) == NULL)' - print '\t\treturn PyErr_NoMemory();' - print '\tif', - if a_factor or a_sub: # Get a fixed-size array array - print '(!geti' + xtype + 'array(args,', - print repr(n_in_args) + ',', - print repr(in_pos[i]) + ',', - if a_factor: print a_factor, - if a_factor and a_sub: print '*', - if a_sub: print a_sub, - print ',', - if (a_sub and a_factor) or xtype != a_type: - print '('+xtype+' *)', - print 'arg' + repr(i+1) + '))' - else: # Get a simple variable - print '(!geti' + xtype + 'arg(args,', - print repr(n_in_args) + ',', - print repr(in_pos[i]) + ',', - if xtype != a_type: - print '('+xtype+' *)', - print '&arg' + repr(i+1) + '))' - print '\t\treturn NULL;' - # - # Begin of function call - # - if type != 'void': - print '\tretval =', func + '(', - else: - print '\t' + func + '(', - # - # Argument list - # - for i in range(len(database)): - if i > 0: print ',', - a_type, a_mode, a_factor, a_sub = database[i] - if a_mode == 'r' and not a_factor: - print '&', - print 'arg' + repr(i+1), - # - # End of function call - # - print ');' - # - # Free varsize arrays - # - for i in range(len(database)): - a_type, a_mode, a_factor, a_sub = database[i] - if a_mode == 's' and a_sub and not isnum(a_sub): - print '\tPyMem_DEL(arg' + repr(i+1) + ');' - # - # Return - # - if n_out_args: - # - # Multiple return values -- construct a tuple - # - if type != 'void': - n_out_args = n_out_args + 1 - if n_out_args == 1: - for i in range(len(database)): - a_type, a_mode, a_factor, a_sub = database[i] - if a_mode == 'r': - break - else: - raise arg_error, 'expected r arg not found' - print '\treturn', - print mkobject(a_type, 'arg' + repr(i+1)) + ';' - else: - print '\t{ PyObject *v = PyTuple_New(', - print n_out_args, ');' - print '\t if (v == NULL) return NULL;' - i_out = 0 - if type != 'void': - print '\t PyTuple_SetItem(v,', - print repr(i_out) + ',', - print mkobject(type, 'retval') + ');' - i_out = i_out + 1 - for i in range(len(database)): - a_type, a_mode, a_factor, a_sub = database[i] - if a_mode == 'r': - print '\t PyTuple_SetItem(v,', - print repr(i_out) + ',', - s = mkobject(a_type, 'arg' + repr(i+1)) - print s + ');' - i_out = i_out + 1 - print '\t return v;' - print '\t}' - else: - # - # Simple function return - # Return None or return value - # - if type == 'void': - print '\tPy_INCREF(Py_None);' - print '\treturn Py_None;' - else: - print '\treturn', mkobject(type, 'retval') + ';' - # - # Stub body closing brace - # - print '}' - - -# Subroutine to return a function call to mknew<type>object(<arg>) -# -def mkobject(type, arg): - if type[:9] == 'unsigned ': - type = type[9:] - return 'mknew' + type + 'object((' + type + ') ' + arg + ')' - return 'mknew' + type + 'object(' + arg + ')' - - -defined_archs = [] - -# usage: cgen [ -Dmach ... ] [ file ] -for arg in sys.argv[1:]: - if arg[:2] == '-D': - defined_archs.append(arg[2:]) - else: - # Open optional file argument - sys.stdin = open(arg, 'r') - - -# Input line number -lno = 0 - - -# Input is divided in two parts, separated by a line containing '%%'. -# <part1> -- literally copied to stdout -# <part2> -- stub definitions - -# Variable indicating the current input part. -# -part = 1 - -# Main loop over the input -# -while 1: - try: - line = raw_input() - except EOFError: - break - # - lno = lno+1 - words = string.split(line) - # - if part == 1: - # - # In part 1, copy everything literally - # except look for a line of just '%%' - # - if words == ['%%']: - part = part + 1 - else: - # - # Look for names of manually written - # stubs: a single percent followed by the name - # of the function in Python. - # The stub name is derived by prefixing 'gl_'. - # - if words and words[0][0] == '%': - func = words[0][1:] - if (not func) and words[1:]: - func = words[1] - if func: - functions.append(func) - else: - print line - continue - if not words: - continue # skip empty line - elif words[0] == 'if': - # if XXX rest - # if !XXX rest - if words[1][0] == '!': - if words[1][1:] in defined_archs: - continue - elif words[1] not in defined_archs: - continue - words = words[2:] - if words[0] == '#include': - print line - elif words[0][:1] == '#': - pass # ignore comment - elif words[0] not in return_types: - err('Line', lno, ': bad return type :', words[0]) - elif len(words) < 2: - err('Line', lno, ': no funcname :', line) - else: - if len(words) % 2 != 0: - err('Line', lno, ': odd argument list :', words[2:]) - else: - database = [] - try: - for i in range(2, len(words), 2): - x = checkarg(words[i], words[i+1]) - database.append(x) - print - print '/*', - for w in words: print w, - print '*/' - generate(words[0], words[1], database) - except arg_error, msg: - err('Line', lno, ':', msg) - - -print -print 'static struct PyMethodDef gl_methods[] = {' -for func in functions: - print '\t{"' + func + '", gl_' + func + '},' -print '\t{NULL, NULL} /* Sentinel */' -print '};' -print -print 'void' -print 'initgl()' -print '{' -print '\t(void) Py_InitModule("gl", gl_methods);' -print '}' diff --git a/Modules/cgensupport.c b/Modules/cgensupport.c deleted file mode 100644 index 7e7d0ff..0000000 --- a/Modules/cgensupport.c +++ /dev/null @@ -1,310 +0,0 @@ - -/* Functions used by cgen output */ - -#include "Python.h" -#include "cgensupport.h" - - -/* Functions to extract arguments. - These needs to know the total number of arguments supplied, - since the argument list is a tuple only of there is more than - one argument. */ - -int -PyArg_GetObject(register PyObject *args, int nargs, int i, PyObject **p_arg) -{ - if (nargs != 1) { - if (args == NULL || !PyTuple_Check(args) || - nargs != PyTuple_Size(args) || - i < 0 || i >= nargs) { - return PyErr_BadArgument(); - } - else { - args = PyTuple_GetItem(args, i); - } - } - if (args == NULL) { - return PyErr_BadArgument(); - } - *p_arg = args; - return 1; -} - -int -PyArg_GetLong(register PyObject *args, int nargs, int i, long *p_arg) -{ - if (nargs != 1) { - if (args == NULL || !PyTuple_Check(args) || - nargs != PyTuple_Size(args) || - i < 0 || i >= nargs) { - return PyErr_BadArgument(); - } - args = PyTuple_GetItem(args, i); - } - if (args == NULL || !PyInt_Check(args)) { - return PyErr_BadArgument(); - } - *p_arg = PyInt_AsLong(args); - return 1; -} - -int -PyArg_GetShort(register PyObject *args, int nargs, int i, short *p_arg) -{ - long x; - if (!PyArg_GetLong(args, nargs, i, &x)) - return 0; - *p_arg = (short) x; - return 1; -} - -static int -extractdouble(register PyObject *v, double *p_arg) -{ - if (v == NULL) { - /* Fall through to error return at end of function */ - } - else if (PyFloat_Check(v)) { - *p_arg = PyFloat_AS_DOUBLE((PyFloatObject *)v); - return 1; - } - else if (PyInt_Check(v)) { - *p_arg = PyInt_AS_LONG((PyIntObject *)v); - return 1; - } - else if (PyLong_Check(v)) { - *p_arg = PyLong_AsDouble(v); - return 1; - } - return PyErr_BadArgument(); -} - -static int -extractfloat(register PyObject *v, float *p_arg) -{ - if (v == NULL) { - /* Fall through to error return at end of function */ - } - else if (PyFloat_Check(v)) { - *p_arg = (float) PyFloat_AS_DOUBLE((PyFloatObject *)v); - return 1; - } - else if (PyInt_Check(v)) { - *p_arg = (float) PyInt_AS_LONG((PyIntObject *)v); - return 1; - } - else if (PyLong_Check(v)) { - *p_arg = (float) PyLong_AsDouble(v); - return 1; - } - return PyErr_BadArgument(); -} - -int -PyArg_GetFloat(register PyObject *args, int nargs, int i, float *p_arg) -{ - PyObject *v; - float x; - if (!PyArg_GetObject(args, nargs, i, &v)) - return 0; - if (!extractfloat(v, &x)) - return 0; - *p_arg = x; - return 1; -} - -int -PyArg_GetString(PyObject *args, int nargs, int i, string *p_arg) -{ - PyObject *v; - if (!PyArg_GetObject(args, nargs, i, &v)) - return 0; - if (!PyString_Check(v)) { - return PyErr_BadArgument(); - } - *p_arg = PyString_AsString(v); - return 1; -} - -int -PyArg_GetChar(PyObject *args, int nargs, int i, char *p_arg) -{ - string x; - if (!PyArg_GetString(args, nargs, i, &x)) - return 0; - if (x[0] == '\0' || x[1] != '\0') { - /* Not exactly one char */ - return PyErr_BadArgument(); - } - *p_arg = x[0]; - return 1; -} - -int -PyArg_GetLongArraySize(PyObject *args, int nargs, int i, long *p_arg) -{ - PyObject *v; - if (!PyArg_GetObject(args, nargs, i, &v)) - return 0; - if (PyTuple_Check(v)) { - *p_arg = PyTuple_Size(v); - return 1; - } - if (PyList_Check(v)) { - *p_arg = PyList_Size(v); - return 1; - } - return PyErr_BadArgument(); -} - -int -PyArg_GetShortArraySize(PyObject *args, int nargs, int i, short *p_arg) -{ - long x; - if (!PyArg_GetLongArraySize(args, nargs, i, &x)) - return 0; - *p_arg = (short) x; - return 1; -} - -/* XXX The following four are too similar. Should share more code. */ - -int -PyArg_GetLongArray(PyObject *args, int nargs, int i, int n, long *p_arg) -{ - PyObject *v, *w; - if (!PyArg_GetObject(args, nargs, i, &v)) - return 0; - if (PyTuple_Check(v)) { - if (PyTuple_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyTuple_GetItem(v, i); - if (!PyInt_Check(w)) { - return PyErr_BadArgument(); - } - p_arg[i] = PyInt_AsLong(w); - } - return 1; - } - else if (PyList_Check(v)) { - if (PyList_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyList_GetItem(v, i); - if (!PyInt_Check(w)) { - return PyErr_BadArgument(); - } - p_arg[i] = PyInt_AsLong(w); - } - return 1; - } - else { - return PyErr_BadArgument(); - } -} - -int -PyArg_GetShortArray(PyObject *args, int nargs, int i, int n, short *p_arg) -{ - PyObject *v, *w; - if (!PyArg_GetObject(args, nargs, i, &v)) - return 0; - if (PyTuple_Check(v)) { - if (PyTuple_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyTuple_GetItem(v, i); - if (!PyInt_Check(w)) { - return PyErr_BadArgument(); - } - p_arg[i] = (short) PyInt_AsLong(w); - } - return 1; - } - else if (PyList_Check(v)) { - if (PyList_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyList_GetItem(v, i); - if (!PyInt_Check(w)) { - return PyErr_BadArgument(); - } - p_arg[i] = (short) PyInt_AsLong(w); - } - return 1; - } - else { - return PyErr_BadArgument(); - } -} - -int -PyArg_GetDoubleArray(PyObject *args, int nargs, int i, int n, double *p_arg) -{ - PyObject *v, *w; - if (!PyArg_GetObject(args, nargs, i, &v)) - return 0; - if (PyTuple_Check(v)) { - if (PyTuple_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyTuple_GetItem(v, i); - if (!extractdouble(w, &p_arg[i])) - return 0; - } - return 1; - } - else if (PyList_Check(v)) { - if (PyList_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyList_GetItem(v, i); - if (!extractdouble(w, &p_arg[i])) - return 0; - } - return 1; - } - else { - return PyErr_BadArgument(); - } -} - -int -PyArg_GetFloatArray(PyObject *args, int nargs, int i, int n, float *p_arg) -{ - PyObject *v, *w; - if (!PyArg_GetObject(args, nargs, i, &v)) - return 0; - if (PyTuple_Check(v)) { - if (PyTuple_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyTuple_GetItem(v, i); - if (!extractfloat(w, &p_arg[i])) - return 0; - } - return 1; - } - else if (PyList_Check(v)) { - if (PyList_Size(v) != n) { - return PyErr_BadArgument(); - } - for (i = 0; i < n; i++) { - w = PyList_GetItem(v, i); - if (!extractfloat(w, &p_arg[i])) - return 0; - } - return 1; - } - else { - return PyErr_BadArgument(); - } -} diff --git a/Modules/cgensupport.h b/Modules/cgensupport.h deleted file mode 100644 index bc901f6..0000000 --- a/Modules/cgensupport.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef Py_CGENSUPPORT_H -#define Py_CGENSUPPORT_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* Definitions used by cgen output */ - -/* XXX This file is obsolete. It is *only* used by glmodule.c. */ - -typedef char *string; - -#define mknewlongobject(x) PyInt_FromLong(x) -#define mknewshortobject(x) PyInt_FromLong((long)x) -#define mknewfloatobject(x) PyFloat_FromDouble(x) -#define mknewcharobject(ch) Py_BuildValue("c", ch) - -#define getichararg PyArg_GetChar -#define getidoublearray PyArg_GetDoubleArray -#define getifloatarg PyArg_GetFloat -#define getifloatarray PyArg_GetFloatArray -#define getilongarg PyArg_GetLong -#define getilongarray PyArg_GetLongArray -#define getilongarraysize PyArg_GetLongArraySize -#define getiobjectarg PyArg_GetObject -#define getishortarg PyArg_GetShort -#define getishortarray PyArg_GetShortArray -#define getishortarraysize PyArg_GetShortArraySize -#define getistringarg PyArg_GetString - -extern int PyArg_GetObject(PyObject *args, int nargs, - int i, PyObject **p_a); -extern int PyArg_GetLong(PyObject *args, int nargs, - int i, long *p_a); -extern int PyArg_GetShort(PyObject *args, int nargs, - int i, short *p_a); -extern int PyArg_GetFloat(PyObject *args, int nargs, - int i, float *p_a); -extern int PyArg_GetString(PyObject *args, int nargs, - int i, string *p_a); -extern int PyArg_GetChar(PyObject *args, int nargs, - int i, char *p_a); -extern int PyArg_GetLongArray(PyObject *args, int nargs, - int i, int n, long *p_a); -extern int PyArg_GetShortArray(PyObject *args, int nargs, - int i, int n, short *p_a); -extern int PyArg_GetDoubleArray(PyObject *args, int nargs, - int i, int n, double *p_a); -extern int PyArg_GetFloatArray(PyObject *args, int nargs, - int i, int n, float *p_a); -extern int PyArg_GetLongArraySize(PyObject *args, int nargs, - int i, long *p_a); -extern int PyArg_GetShortArraySize(PyObject *args, int nargs, - int i, short *p_a); -extern int PyArg_GetDoubleArraySize(PyObject *args, int nargs, - int i, double *p_a); -extern int PyArg_GetFloatArraySize(PyObject *args, int nargs, - int i, float *p_a); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_CGENSUPPORT_H */ diff --git a/Modules/clmodule.c b/Modules/clmodule.c deleted file mode 100644 index a535e03..0000000 --- a/Modules/clmodule.c +++ /dev/null @@ -1,2559 +0,0 @@ - - -/* Cl objects */ - -#define CLDEBUG - -#include <stdarg.h> -#include <cl.h> -#if defined(CL_JPEG_SOFTWARE) && !defined(CL_JPEG_COSMO) -#include <dmedia/cl_cosmo.h> -#endif -#include "Python.h" - -typedef struct { - PyObject_HEAD - int ob_isCompressor; /* Compressor or Decompressor */ - CL_Handle ob_compressorHdl; - int *ob_paramtypes; - int ob_nparams; -} clobject; - -static PyObject *ClError; /* exception cl.error */ - -static int error_handler_called = 0; - -/* - * We want to use the function prototypes that are available in the C - * compiler on the SGI. Because of that, we need to declare the first - * argument of the compressor and decompressor methods as "object *", - * even though they are really "clobject *". Therefore we cast the - * argument to the proper type using this macro. - */ -#define SELF ((clobject *) self) - -/******************************************************************** - Utility routines. -********************************************************************/ -static void -cl_ErrorHandler(CL_Handle handle, int code, const char *fmt, ...) -{ - va_list ap; - char errbuf[BUFSIZ]; /* hopefully big enough */ - char *p; - - if (PyErr_Occurred()) /* don't change existing error */ - return; - error_handler_called = 1; - va_start(ap, fmt); - vsprintf(errbuf, fmt, ap); - va_end(ap); - p = &errbuf[strlen(errbuf) - 1]; /* swat the line feed */ - if (*p == '\n') - *p = 0; - PyErr_SetString(ClError, errbuf); -} - -/* - * This assumes that params are always in the range 0 to some maximum. - */ -static int -param_type_is_float(clobject *self, int param) -{ - int bufferlength; - - if (self->ob_paramtypes == NULL) { - error_handler_called = 0; - bufferlength = clQueryParams(self->ob_compressorHdl, 0, 0); - if (error_handler_called) - return -1; - - self->ob_paramtypes = PyMem_NEW(int, bufferlength); - if (self->ob_paramtypes == NULL) - return -1; - self->ob_nparams = bufferlength / 2; - - (void) clQueryParams(self->ob_compressorHdl, - self->ob_paramtypes, bufferlength); - if (error_handler_called) { - PyMem_DEL(self->ob_paramtypes); - self->ob_paramtypes = NULL; - return -1; - } - } - - if (param < 0 || param >= self->ob_nparams) - return -1; - - if (self->ob_paramtypes[param*2 + 1] == CL_FLOATING_ENUM_VALUE || - self->ob_paramtypes[param*2 + 1] == CL_FLOATING_RANGE_VALUE) - return 1; - else - return 0; -} - -/******************************************************************** - Single image compression/decompression. -********************************************************************/ -static PyObject * -cl_CompressImage(PyObject *self, PyObject *args) -{ - int compressionScheme, width, height, originalFormat; - float compressionRatio; - int frameBufferSize, compressedBufferSize; - char *frameBuffer; - PyObject *compressedBuffer; - - if (!PyArg_ParseTuple(args, "iiiifs#", &compressionScheme, - &width, &height, - &originalFormat, &compressionRatio, &frameBuffer, - &frameBufferSize)) - return NULL; - - retry: - compressedBuffer = PyString_FromStringAndSize(NULL, frameBufferSize); - if (compressedBuffer == NULL) - return NULL; - - compressedBufferSize = frameBufferSize; - error_handler_called = 0; - if (clCompressImage(compressionScheme, width, height, originalFormat, - compressionRatio, (void *) frameBuffer, - &compressedBufferSize, - (void *) PyString_AsString(compressedBuffer)) - == FAILURE || error_handler_called) { - Py_DECREF(compressedBuffer); - if (!error_handler_called) - PyErr_SetString(ClError, "clCompressImage failed"); - return NULL; - } - - if (compressedBufferSize > frameBufferSize) { - frameBufferSize = compressedBufferSize; - Py_DECREF(compressedBuffer); - goto retry; - } - - if (compressedBufferSize < frameBufferSize) - _PyString_Resize(&compressedBuffer, compressedBufferSize); - - return compressedBuffer; -} - -static PyObject * -cl_DecompressImage(PyObject *self, PyObject *args) -{ - int compressionScheme, width, height, originalFormat; - char *compressedBuffer; - int compressedBufferSize, frameBufferSize; - PyObject *frameBuffer; - - if (!PyArg_ParseTuple(args, "iiiis#", &compressionScheme, &width, &height, - &originalFormat, &compressedBuffer, - &compressedBufferSize)) - return NULL; - - frameBufferSize = width * height * CL_BytesPerPixel(originalFormat); - - frameBuffer = PyString_FromStringAndSize(NULL, frameBufferSize); - if (frameBuffer == NULL) - return NULL; - - error_handler_called = 0; - if (clDecompressImage(compressionScheme, width, height, originalFormat, - compressedBufferSize, compressedBuffer, - (void *) PyString_AsString(frameBuffer)) - == FAILURE || error_handler_called) { - Py_DECREF(frameBuffer); - if (!error_handler_called) - PyErr_SetString(ClError, "clDecompressImage failed"); - return NULL; - } - - return frameBuffer; -} - -/******************************************************************** - Sequential compression/decompression. -********************************************************************/ -#define CheckCompressor(self) if ((self)->ob_compressorHdl == NULL) { \ - PyErr_SetString(PyExc_RuntimeError, "(de)compressor not active"); \ - return NULL; \ -} - -static PyObject * -doClose(clobject *self, int (*close_func)(CL_Handle)) -{ - CheckCompressor(self); - - error_handler_called = 0; - if ((*close_func)(self->ob_compressorHdl) == FAILURE || - error_handler_called) { - if (!error_handler_called) - PyErr_SetString(ClError, "close failed"); - return NULL; - } - - self->ob_compressorHdl = NULL; - - if (self->ob_paramtypes) - PyMem_DEL(self->ob_paramtypes); - self->ob_paramtypes = NULL; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -clm_CloseCompressor(PyObject *self) -{ - return doClose(SELF, clCloseCompressor); -} - -static PyObject * -clm_CloseDecompressor(PyObject *self) -{ - return doClose(SELF, clCloseDecompressor); -} - -static PyObject * -clm_Compress(PyObject *self, PyObject *args) -{ - int numberOfFrames; - int frameBufferSize, compressedBufferSize, size; - char *frameBuffer; - PyObject *data; - - CheckCompressor(SELF); - - if (!PyArg_Parse(args, "(is#)", &numberOfFrames, - &frameBuffer, &frameBufferSize)) - return NULL; - - error_handler_called = 0; - size = clGetParam(SELF->ob_compressorHdl, CL_COMPRESSED_BUFFER_SIZE); - compressedBufferSize = size; - if (error_handler_called) - return NULL; - - data = PyString_FromStringAndSize(NULL, size); - if (data == NULL) - return NULL; - - error_handler_called = 0; - if (clCompress(SELF->ob_compressorHdl, numberOfFrames, - (void *) frameBuffer, &compressedBufferSize, - (void *) PyString_AsString(data)) == FAILURE || - error_handler_called) { - Py_DECREF(data); - if (!error_handler_called) - PyErr_SetString(ClError, "compress failed"); - return NULL; - } - - if (compressedBufferSize < size) - if (_PyString_Resize(&data, compressedBufferSize)) - return NULL; - - if (compressedBufferSize > size) { - /* we didn't get all "compressed" data */ - Py_DECREF(data); - PyErr_SetString(ClError, - "compressed data is more than fitted"); - return NULL; - } - - return data; -} - -static PyObject * -clm_Decompress(PyObject *self, PyObject *args) -{ - PyObject *data; - int numberOfFrames; - char *compressedData; - int compressedDataSize, dataSize; - - CheckCompressor(SELF); - - if (!PyArg_Parse(args, "(is#)", &numberOfFrames, &compressedData, - &compressedDataSize)) - return NULL; - - error_handler_called = 0; - dataSize = clGetParam(SELF->ob_compressorHdl, CL_FRAME_BUFFER_SIZE); - if (error_handler_called) - return NULL; - - data = PyString_FromStringAndSize(NULL, dataSize); - if (data == NULL) - return NULL; - - error_handler_called = 0; - if (clDecompress(SELF->ob_compressorHdl, numberOfFrames, - compressedDataSize, (void *) compressedData, - (void *) PyString_AsString(data)) == FAILURE || - error_handler_called) { - Py_DECREF(data); - if (!error_handler_called) - PyErr_SetString(ClError, "decompress failed"); - return NULL; - } - - return data; -} - -static PyObject * -doParams(clobject *self, PyObject *args, int (*func)(CL_Handle, int *, int), - int modified) -{ - PyObject *list, *v; - int *PVbuffer; - int length; - int i; - float number; - - CheckCompressor(self); - - if (!PyArg_Parse(args, "O", &list)) - return NULL; - if (!PyList_Check(list)) { - PyErr_BadArgument(); - return NULL; - } - length = PyList_Size(list); - PVbuffer = PyMem_NEW(int, length); - if (PVbuffer == NULL) - return PyErr_NoMemory(); - for (i = 0; i < length; i++) { - v = PyList_GetItem(list, i); - if (PyFloat_Check(v)) { - number = PyFloat_AsDouble(v); - PVbuffer[i] = CL_TypeIsInt(number); - } else if (PyInt_Check(v)) { - PVbuffer[i] = PyInt_AsLong(v); - if ((i & 1) && - param_type_is_float(self, PVbuffer[i-1]) > 0) { - number = PVbuffer[i]; - PVbuffer[i] = CL_TypeIsInt(number); - } - } else { - PyMem_DEL(PVbuffer); - PyErr_BadArgument(); - return NULL; - } - } - - error_handler_called = 0; - (*func)(self->ob_compressorHdl, PVbuffer, length); - if (error_handler_called) { - PyMem_DEL(PVbuffer); - return NULL; - } - - if (modified) { - for (i = 0; i < length; i++) { - if ((i & 1) && - param_type_is_float(self, PVbuffer[i-1]) > 0) { - number = CL_TypeIsFloat(PVbuffer[i]); - v = PyFloat_FromDouble(number); - } else - v = PyInt_FromLong(PVbuffer[i]); - PyList_SetItem(list, i, v); - } - } - - PyMem_DEL(PVbuffer); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -clm_GetParams(PyObject *self, PyObject *args) -{ - return doParams(SELF, args, clGetParams, 1); -} - -static PyObject * -clm_SetParams(PyObject *self, PyObject *args) -{ - return doParams(SELF, args, clSetParams, 0); -} - -static PyObject * -do_get(clobject *self, PyObject *args, int (*func)(CL_Handle, int)) -{ - int paramID, value; - float fvalue; - - CheckCompressor(self); - - if (!PyArg_Parse(args, "i", ¶mID)) - return NULL; - - error_handler_called = 0; - value = (*func)(self->ob_compressorHdl, paramID); - if (error_handler_called) - return NULL; - - if (param_type_is_float(self, paramID) > 0) { - fvalue = CL_TypeIsFloat(value); - return PyFloat_FromDouble(fvalue); - } - - return PyInt_FromLong(value); -} - -static PyObject * -clm_GetParam(PyObject *self, PyObject *args) -{ - return do_get(SELF, args, clGetParam); -} - -static PyObject * -clm_GetDefault(PyObject *self, PyObject *args) -{ - return do_get(SELF, args, clGetDefault); -} - -static PyObject * -clm_SetParam(PyObject *self, PyObject *args) -{ - int paramID, value; - float fvalue; - - CheckCompressor(SELF); - - if (!PyArg_Parse(args, "(ii)", ¶mID, &value)) { - PyErr_Clear(); - if (!PyArg_Parse(args, "(if)", ¶mID, &fvalue)) { - PyErr_Clear(); - PyErr_SetString(PyExc_TypeError, - "bad argument list (format '(ii)' or '(if)')"); - return NULL; - } - value = CL_TypeIsInt(fvalue); - } else { - if (param_type_is_float(SELF, paramID) > 0) { - fvalue = value; - value = CL_TypeIsInt(fvalue); - } - } - - error_handler_called = 0; - value = clSetParam(SELF->ob_compressorHdl, paramID, value); - if (error_handler_called) - return NULL; - - if (param_type_is_float(SELF, paramID) > 0) - return PyFloat_FromDouble(CL_TypeIsFloat(value)); - else - return PyInt_FromLong(value); -} - -static PyObject * -clm_GetParamID(PyObject *self, PyObject *args) -{ - char *name; - int value; - - CheckCompressor(SELF); - - if (!PyArg_Parse(args, "s", &name)) - return NULL; - - error_handler_called = 0; - value = clGetParamID(SELF->ob_compressorHdl, name); - if (value == FAILURE || error_handler_called) { - if (!error_handler_called) - PyErr_SetString(ClError, "getparamid failed"); - return NULL; - } - - return PyInt_FromLong(value); -} - -static PyObject * -clm_QueryParams(PyObject *self) -{ - int bufferlength; - int *PVbuffer; - PyObject *list; - int i; - - CheckCompressor(SELF); - - error_handler_called = 0; - bufferlength = clQueryParams(SELF->ob_compressorHdl, 0, 0); - if (error_handler_called) - return NULL; - - PVbuffer = PyMem_NEW(int, bufferlength); - if (PVbuffer == NULL) - return PyErr_NoMemory(); - - bufferlength = clQueryParams(SELF->ob_compressorHdl, PVbuffer, - bufferlength); - if (error_handler_called) { - PyMem_DEL(PVbuffer); - return NULL; - } - - list = PyList_New(bufferlength); - if (list == NULL) { - PyMem_DEL(PVbuffer); - return NULL; - } - - for (i = 0; i < bufferlength; i++) { - if (i & 1) - PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i])); - else if (PVbuffer[i] == 0) { - Py_INCREF(Py_None); - PyList_SetItem(list, i, Py_None); - } else - PyList_SetItem(list, i, - PyString_FromString((char *) PVbuffer[i])); - } - - PyMem_DEL(PVbuffer); - - return list; -} - -static PyObject * -clm_GetMinMax(PyObject *self, PyObject *args) -{ - int param, min, max; - float fmin, fmax; - - CheckCompressor(SELF); - - if (!PyArg_Parse(args, "i", ¶m)) - return NULL; - - clGetMinMax(SELF->ob_compressorHdl, param, &min, &max); - - if (param_type_is_float(SELF, param) > 0) { - fmin = CL_TypeIsFloat(min); - fmax = CL_TypeIsFloat(max); - return Py_BuildValue("(ff)", fmin, fmax); - } - - return Py_BuildValue("(ii)", min, max); -} - -static PyObject * -clm_GetName(PyObject *self, PyObject *args) -{ - int param; - char *name; - - CheckCompressor(SELF); - - if (!PyArg_Parse(args, "i", ¶m)) - return NULL; - - error_handler_called = 0; - name = clGetName(SELF->ob_compressorHdl, param); - if (name == NULL || error_handler_called) { - if (!error_handler_called) - PyErr_SetString(ClError, "getname failed"); - return NULL; - } - - return PyString_FromString(name); -} - -static PyObject * -clm_QuerySchemeFromHandle(PyObject *self) -{ - CheckCompressor(SELF); - return PyInt_FromLong(clQuerySchemeFromHandle(SELF->ob_compressorHdl)); -} - -static PyObject * -clm_ReadHeader(PyObject *self, PyObject *args) -{ - char *header; - int headerSize; - - CheckCompressor(SELF); - - if (!PyArg_Parse(args, "s#", &header, &headerSize)) - return NULL; - - return PyInt_FromLong(clReadHeader(SELF->ob_compressorHdl, - headerSize, header)); -} - -static PyMethodDef compressor_methods[] = { - {"close", clm_CloseCompressor, METH_NOARGS}, /* alias */ - {"CloseCompressor", clm_CloseCompressor, METH_NOARGS}, - {"Compress", clm_Compress, METH_OLDARGS}, - {"GetDefault", clm_GetDefault, METH_OLDARGS}, - {"GetMinMax", clm_GetMinMax, METH_OLDARGS}, - {"GetName", clm_GetName, METH_OLDARGS}, - {"GetParam", clm_GetParam, METH_OLDARGS}, - {"GetParamID", clm_GetParamID, METH_OLDARGS}, - {"GetParams", clm_GetParams, METH_OLDARGS}, - {"QueryParams", clm_QueryParams, METH_NOARGS}, - {"QuerySchemeFromHandle",clm_QuerySchemeFromHandle, METH_NOARGS}, - {"SetParam", clm_SetParam, METH_OLDARGS}, - {"SetParams", clm_SetParams, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyMethodDef decompressor_methods[] = { - {"close", clm_CloseDecompressor, METH_NOARGS}, /* alias */ - {"CloseDecompressor", clm_CloseDecompressor, METH_NOARGS}, - {"Decompress", clm_Decompress, METH_OLDARGS}, - {"GetDefault", clm_GetDefault, METH_OLDARGS}, - {"GetMinMax", clm_GetMinMax, METH_OLDARGS}, - {"GetName", clm_GetName, METH_OLDARGS}, - {"GetParam", clm_GetParam, METH_OLDARGS}, - {"GetParamID", clm_GetParamID, METH_OLDARGS}, - {"GetParams", clm_GetParams, METH_OLDARGS}, - {"ReadHeader", clm_ReadHeader, METH_OLDARGS}, - {"QueryParams", clm_QueryParams, METH_NOARGS}, - {"QuerySchemeFromHandle",clm_QuerySchemeFromHandle, METH_NOARGS}, - {"SetParam", clm_SetParam, METH_OLDARGS}, - {"SetParams", clm_SetParams, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -static void -cl_dealloc(PyObject *self) -{ - if (SELF->ob_compressorHdl) { - if (SELF->ob_isCompressor) - clCloseCompressor(SELF->ob_compressorHdl); - else - clCloseDecompressor(SELF->ob_compressorHdl); - } - PyObject_Del(self); -} - -static PyObject * -cl_getattr(PyObject *self, char *name) -{ - if (SELF->ob_isCompressor) - return Py_FindMethod(compressor_methods, self, name); - else - return Py_FindMethod(decompressor_methods, self, name); -} - -static PyTypeObject Cltype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "cl.cl", /*tp_name*/ - sizeof(clobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)cl_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)cl_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ -}; - -static PyObject * -doOpen(PyObject *self, PyObject *args, int (*open_func)(int, CL_Handle *), - int iscompressor) -{ - int scheme; - clobject *new; - - if (!PyArg_ParseTuple(args, "i", &scheme)) - return NULL; - - new = PyObject_New(clobject, &Cltype); - if (new == NULL) - return NULL; - - new->ob_compressorHdl = NULL; - new->ob_isCompressor = iscompressor; - new->ob_paramtypes = NULL; - - error_handler_called = 0; - if ((*open_func)(scheme, &new->ob_compressorHdl) == FAILURE || - error_handler_called) { - Py_DECREF(new); - if (!error_handler_called) - PyErr_SetString(ClError, "Open(De)Compressor failed"); - return NULL; - } - return (PyObject *)new; -} - -static PyObject * -cl_OpenCompressor(PyObject *self, PyObject *args) -{ - return doOpen(self, args, clOpenCompressor, 1); -} - -static PyObject * -cl_OpenDecompressor(PyObject *self, PyObject *args) -{ - return doOpen(self, args, clOpenDecompressor, 0); -} - -static PyObject * -cl_QueryScheme(PyObject *self, PyObject *args) -{ - char *header; - int headerlen; - int scheme; - - if (!PyArg_ParseTuple(args, "s#", &header, &headerlen)) - return NULL; - - scheme = clQueryScheme(header); - if (scheme < 0) { - PyErr_SetString(ClError, "unknown compression scheme"); - return NULL; - } - - return PyInt_FromLong(scheme); -} - -static PyObject * -cl_QueryMaxHeaderSize(PyObject *self, PyObject *args) -{ - int scheme; - - if (!PyArg_ParseTuple(args, "i", &scheme)) - return NULL; - - return PyInt_FromLong(clQueryMaxHeaderSize(scheme)); -} - -static PyObject * -cl_QueryAlgorithms(PyObject *self, PyObject *args) -{ - int algorithmMediaType; - int bufferlength; - int *PVbuffer; - PyObject *list; - int i; - - if (!PyArg_ParseTuple(args, "i", &algorithmMediaType)) - return NULL; - - error_handler_called = 0; - bufferlength = clQueryAlgorithms(algorithmMediaType, 0, 0); - if (error_handler_called) - return NULL; - - PVbuffer = PyMem_NEW(int, bufferlength); - if (PVbuffer == NULL) - return PyErr_NoMemory(); - - bufferlength = clQueryAlgorithms(algorithmMediaType, PVbuffer, - bufferlength); - if (error_handler_called) { - PyMem_DEL(PVbuffer); - return NULL; - } - - list = PyList_New(bufferlength); - if (list == NULL) { - PyMem_DEL(PVbuffer); - return NULL; - } - - for (i = 0; i < bufferlength; i++) { - if (i & 1) - PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i])); - else if (PVbuffer[i] == 0) { - Py_INCREF(Py_None); - PyList_SetItem(list, i, Py_None); - } else - PyList_SetItem(list, i, - PyString_FromString((char *) PVbuffer[i])); - } - - PyMem_DEL(PVbuffer); - - return list; -} - -static PyObject * -cl_QuerySchemeFromName(PyObject *self, PyObject *args) -{ - int algorithmMediaType; - char *name; - int scheme; - - if (!PyArg_ParseTuple(args, "is", &algorithmMediaType, &name)) - return NULL; - - error_handler_called = 0; - scheme = clQuerySchemeFromName(algorithmMediaType, name); - if (error_handler_called) { - PyErr_SetString(ClError, "unknown compression scheme"); - return NULL; - } - - return PyInt_FromLong(scheme); -} - -static PyObject * -cl_GetAlgorithmName(PyObject *self, PyObject *args) -{ - int scheme; - char *name; - - if (!PyArg_ParseTuple(args, "i", &scheme)) - return NULL; - - name = clGetAlgorithmName(scheme); - if (name == 0) { - PyErr_SetString(ClError, "unknown compression scheme"); - return NULL; - } - - return PyString_FromString(name); -} - -static PyObject * -do_set(PyObject *self, PyObject *args, int (*func)(int, int, int)) -{ - int scheme, paramID, value; - float fvalue; - int is_float = 0; - - if (!PyArg_ParseTuple(args, "iii", &scheme, ¶mID, &value)) { - PyErr_Clear(); - if (!PyArg_ParseTuple(args, "iif", &scheme, ¶mID, &fvalue)) { - PyErr_Clear(); - PyErr_SetString(PyExc_TypeError, - "bad argument list (format '(iii)' or '(iif)')"); - return NULL; - } - value = CL_TypeIsInt(fvalue); - is_float = 1; - } else { - /* check some parameters which we know to be floats */ - switch (scheme) { - case CL_COMPRESSION_RATIO: - case CL_SPEED: - fvalue = value; - value = CL_TypeIsInt(fvalue); - is_float = 1; - break; - } - } - - error_handler_called = 0; - value = (*func)(scheme, paramID, value); - if (error_handler_called) - return NULL; - - if (is_float) - return PyFloat_FromDouble(CL_TypeIsFloat(value)); - else - return PyInt_FromLong(value); -} - -static PyObject * -cl_SetDefault(PyObject *self, PyObject *args) -{ - return do_set(self, args, clSetDefault); -} - -static PyObject * -cl_SetMin(PyObject *self, PyObject *args) -{ - return do_set(self, args, clSetMin); -} - -static PyObject * -cl_SetMax(PyObject *self, PyObject *args) -{ - return do_set(self, args, clSetMax); -} - -#define func(name, handler) \ -static PyObject *cl_##name(PyObject *self, PyObject *args) \ -{ \ - int x; \ - if (!PyArg_ParseTuple(args, "i", &x)) return NULL; \ - return Py##handler(CL_##name(x)); \ -} - -#define func2(name, handler) \ -static PyObject *cl_##name(PyObject *self, PyObject *args) \ -{ \ - int a1, a2; \ - if (!PyArg_ParseTuple(args, "ii", &a1, &a2)) return NULL; \ - return Py##handler(CL_##name(a1, a2)); \ -} - -func(BytesPerSample, Int_FromLong) -func(BytesPerPixel, Int_FromLong) -func(AudioFormatName, String_FromString) -func(VideoFormatName, String_FromString) -func(AlgorithmNumber, Int_FromLong) -func(AlgorithmType, Int_FromLong) -func2(Algorithm, Int_FromLong) -func(ParamNumber, Int_FromLong) -func(ParamType, Int_FromLong) -func2(ParamID, Int_FromLong) - -#ifdef CLDEBUG - static PyObject * -cvt_type(PyObject *self, PyObject *args) -{ - int number; - float fnumber; - - if (PyArg_Parse(args, "i", &number)) - return PyFloat_FromDouble(CL_TypeIsFloat(number)); - else { - PyErr_Clear(); - if (PyArg_Parse(args, "f", &fnumber)) - return PyInt_FromLong(CL_TypeIsInt(fnumber)); - return NULL; - } -} -#endif - -static PyMethodDef cl_methods[] = { - {"CompressImage", cl_CompressImage, METH_VARARGS}, - {"DecompressImage", cl_DecompressImage, METH_VARARGS}, - {"GetAlgorithmName", cl_GetAlgorithmName, METH_VARARGS}, - {"OpenCompressor", cl_OpenCompressor, METH_VARARGS}, - {"OpenDecompressor", cl_OpenDecompressor, METH_VARARGS}, - {"QueryAlgorithms", cl_QueryAlgorithms, METH_VARARGS}, - {"QueryMaxHeaderSize", cl_QueryMaxHeaderSize, METH_VARARGS}, - {"QueryScheme", cl_QueryScheme, METH_VARARGS}, - {"QuerySchemeFromName", cl_QuerySchemeFromName, METH_VARARGS}, - {"SetDefault", cl_SetDefault, METH_VARARGS}, - {"SetMax", cl_SetMax, METH_VARARGS}, - {"SetMin", cl_SetMin, METH_VARARGS}, - {"BytesPerSample", cl_BytesPerSample, METH_VARARGS}, - {"BytesPerPixel", cl_BytesPerPixel, METH_VARARGS}, - {"AudioFormatName", cl_AudioFormatName, METH_VARARGS}, - {"VideoFormatName", cl_VideoFormatName, METH_VARARGS}, - {"AlgorithmNumber", cl_AlgorithmNumber, METH_VARARGS}, - {"AlgorithmType", cl_AlgorithmType, METH_VARARGS}, - {"Algorithm", cl_Algorithm, METH_VARARGS}, - {"ParamNumber", cl_ParamNumber, METH_VARARGS}, - {"ParamType", cl_ParamType, METH_VARARGS}, - {"ParamID", cl_ParamID, METH_VARARGS}, -#ifdef CLDEBUG - {"cvt_type", cvt_type, METH_VARARGS}, -#endif - {NULL, NULL} /* Sentinel */ -}; - -#ifdef CL_JPEG_SOFTWARE -#define IRIX_5_3_LIBRARY -#endif - -void -initcl(void) -{ - PyObject *m, *d, *x; - - m = Py_InitModule("cl", cl_methods); - if (m == NULL) - return; - d = PyModule_GetDict(m); - - ClError = PyErr_NewException("cl.error", NULL, NULL); - (void) PyDict_SetItemString(d, "error", ClError); - -#ifdef CL_ADDED_ALGORITHM_ERROR - x = PyInt_FromLong(CL_ADDED_ALGORITHM_ERROR); - if (x == NULL || PyDict_SetItemString(d, "ADDED_ALGORITHM_ERROR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ALAW - x = PyInt_FromLong(CL_ALAW); - if (x == NULL || PyDict_SetItemString(d, "ALAW", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ALGORITHM_ID - x = PyInt_FromLong(CL_ALGORITHM_ID); - if (x == NULL || PyDict_SetItemString(d, "ALGORITHM_ID", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ALGORITHM_TABLE_FULL - x = PyInt_FromLong(CL_ALGORITHM_TABLE_FULL); - if (x == NULL || PyDict_SetItemString(d, "ALGORITHM_TABLE_FULL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ALGORITHM_VERSION - x = PyInt_FromLong(CL_ALGORITHM_VERSION); - if (x == NULL || PyDict_SetItemString(d, "ALGORITHM_VERSION", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ALG_AUDIO - x = PyInt_FromLong(CL_ALG_AUDIO); - if (x == NULL || PyDict_SetItemString(d, "ALG_AUDIO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ALG_VIDEO - x = PyInt_FromLong(CL_ALG_VIDEO); - if (x == NULL || PyDict_SetItemString(d, "ALG_VIDEO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AUDIO - x = PyInt_FromLong(CL_AUDIO); - if (x == NULL || PyDict_SetItemString(d, "AUDIO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_BITRATE_POLICY - x = PyInt_FromLong(CL_AWARE_BITRATE_POLICY); - if (x == NULL || PyDict_SetItemString(d, "AWARE_BITRATE_POLICY", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_BITRATE_TARGET - x = PyInt_FromLong(CL_AWARE_BITRATE_TARGET); - if (x == NULL || PyDict_SetItemString(d, "AWARE_BITRATE_TARGET", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_CHANNEL_POLICY - x = PyInt_FromLong(CL_AWARE_CHANNEL_POLICY); - if (x == NULL || PyDict_SetItemString(d, "AWARE_CHANNEL_POLICY", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_CONST_QUAL - x = PyInt_FromLong(CL_AWARE_CONST_QUAL); - if (x == NULL || PyDict_SetItemString(d, "AWARE_CONST_QUAL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_ERROR - x = PyInt_FromLong(CL_AWARE_ERROR); - if (x == NULL || PyDict_SetItemString(d, "AWARE_ERROR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_FIXED_RATE - x = PyInt_FromLong(CL_AWARE_FIXED_RATE); - if (x == NULL || PyDict_SetItemString(d, "AWARE_FIXED_RATE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_INDEPENDENT - x = PyInt_FromLong(CL_AWARE_INDEPENDENT); - if (x == NULL || PyDict_SetItemString(d, "AWARE_INDEPENDENT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_JOINT_STEREO - x = PyInt_FromLong(CL_AWARE_JOINT_STEREO); - if (x == NULL || PyDict_SetItemString(d, "AWARE_JOINT_STEREO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_LAYER - x = PyInt_FromLong(CL_AWARE_LAYER); - if (x == NULL || PyDict_SetItemString(d, "AWARE_LAYER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_LOSSLESS - x = PyInt_FromLong(CL_AWARE_LOSSLESS); - if (x == NULL || PyDict_SetItemString(d, "AWARE_LOSSLESS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_MPEG_AUDIO - x = PyInt_FromLong(CL_AWARE_MPEG_AUDIO); - if (x == NULL || PyDict_SetItemString(d, "AWARE_MPEG_AUDIO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_MPEG_LAYER_I - x = PyInt_FromLong(CL_AWARE_MPEG_LAYER_I); - if (x == NULL || PyDict_SetItemString(d, "AWARE_MPEG_LAYER_I", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_MPEG_LAYER_II - x = PyInt_FromLong(CL_AWARE_MPEG_LAYER_II); - if (x == NULL || PyDict_SetItemString(d, "AWARE_MPEG_LAYER_II", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_MULTIRATE - x = PyInt_FromLong(CL_AWARE_MULTIRATE); - if (x == NULL || PyDict_SetItemString(d, "AWARE_MULTIRATE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_NOISE_MARGIN - x = PyInt_FromLong(CL_AWARE_NOISE_MARGIN); - if (x == NULL || PyDict_SetItemString(d, "AWARE_NOISE_MARGIN", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_AWARE_STEREO - x = PyInt_FromLong(CL_AWARE_STEREO); - if (x == NULL || PyDict_SetItemString(d, "AWARE_STEREO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_ALGORITHM_NAME - x = PyInt_FromLong(CL_BAD_ALGORITHM_NAME); - if (x == NULL || PyDict_SetItemString(d, "BAD_ALGORITHM_NAME", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_ALGORITHM_TYPE - x = PyInt_FromLong(CL_BAD_ALGORITHM_TYPE); - if (x == NULL || PyDict_SetItemString(d, "BAD_ALGORITHM_TYPE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BLOCK_SIZE - x = PyInt_FromLong(CL_BAD_BLOCK_SIZE); - if (x == NULL || PyDict_SetItemString(d, "BAD_BLOCK_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BOARD - x = PyInt_FromLong(CL_BAD_BOARD); - if (x == NULL || PyDict_SetItemString(d, "BAD_BOARD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFERING - x = PyInt_FromLong(CL_BAD_BUFFERING); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERING", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFERLENGTH_NEG - x = PyInt_FromLong(CL_BAD_BUFFERLENGTH_NEG); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_NEG", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFERLENGTH_ODD - x = PyInt_FromLong(CL_BAD_BUFFERLENGTH_ODD); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_ODD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFER_EXISTS - x = PyInt_FromLong(CL_BAD_BUFFER_EXISTS); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_EXISTS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFER_HANDLE - x = PyInt_FromLong(CL_BAD_BUFFER_HANDLE); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_HANDLE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFER_POINTER - x = PyInt_FromLong(CL_BAD_BUFFER_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFER_QUERY_SIZE - x = PyInt_FromLong(CL_BAD_BUFFER_QUERY_SIZE); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_QUERY_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFER_SIZE - x = PyInt_FromLong(CL_BAD_BUFFER_SIZE); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFER_SIZE_POINTER - x = PyInt_FromLong(CL_BAD_BUFFER_SIZE_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_SIZE_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_BUFFER_TYPE - x = PyInt_FromLong(CL_BAD_BUFFER_TYPE); - if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_TYPE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_COMPRESSION_SCHEME - x = PyInt_FromLong(CL_BAD_COMPRESSION_SCHEME); - if (x == NULL || PyDict_SetItemString(d, "BAD_COMPRESSION_SCHEME", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_COMPRESSOR_HANDLE - x = PyInt_FromLong(CL_BAD_COMPRESSOR_HANDLE); - if (x == NULL || PyDict_SetItemString(d, "BAD_COMPRESSOR_HANDLE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_COMPRESSOR_HANDLE_POINTER - x = PyInt_FromLong(CL_BAD_COMPRESSOR_HANDLE_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_COMPRESSOR_HANDLE_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_FRAME_SIZE - x = PyInt_FromLong(CL_BAD_FRAME_SIZE); - if (x == NULL || PyDict_SetItemString(d, "BAD_FRAME_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_FUNCTIONALITY - x = PyInt_FromLong(CL_BAD_FUNCTIONALITY); - if (x == NULL || PyDict_SetItemString(d, "BAD_FUNCTIONALITY", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_FUNCTION_POINTER - x = PyInt_FromLong(CL_BAD_FUNCTION_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_FUNCTION_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_HEADER_SIZE - x = PyInt_FromLong(CL_BAD_HEADER_SIZE); - if (x == NULL || PyDict_SetItemString(d, "BAD_HEADER_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_INITIAL_VALUE - x = PyInt_FromLong(CL_BAD_INITIAL_VALUE); - if (x == NULL || PyDict_SetItemString(d, "BAD_INITIAL_VALUE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_INTERNAL_FORMAT - x = PyInt_FromLong(CL_BAD_INTERNAL_FORMAT); - if (x == NULL || PyDict_SetItemString(d, "BAD_INTERNAL_FORMAT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_LICENSE - x = PyInt_FromLong(CL_BAD_LICENSE); - if (x == NULL || PyDict_SetItemString(d, "BAD_LICENSE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_MIN_GT_MAX - x = PyInt_FromLong(CL_BAD_MIN_GT_MAX); - if (x == NULL || PyDict_SetItemString(d, "BAD_MIN_GT_MAX", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_NO_BUFFERSPACE - x = PyInt_FromLong(CL_BAD_NO_BUFFERSPACE); - if (x == NULL || PyDict_SetItemString(d, "BAD_NO_BUFFERSPACE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_NUMBER_OF_BLOCKS - x = PyInt_FromLong(CL_BAD_NUMBER_OF_BLOCKS); - if (x == NULL || PyDict_SetItemString(d, "BAD_NUMBER_OF_BLOCKS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_PARAM - x = PyInt_FromLong(CL_BAD_PARAM); - if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_PARAM_ID_POINTER - x = PyInt_FromLong(CL_BAD_PARAM_ID_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM_ID_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_PARAM_TYPE - x = PyInt_FromLong(CL_BAD_PARAM_TYPE); - if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM_TYPE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_POINTER - x = PyInt_FromLong(CL_BAD_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_PVBUFFER - x = PyInt_FromLong(CL_BAD_PVBUFFER); - if (x == NULL || PyDict_SetItemString(d, "BAD_PVBUFFER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_SCHEME_POINTER - x = PyInt_FromLong(CL_BAD_SCHEME_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_SCHEME_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_STREAM_HEADER - x = PyInt_FromLong(CL_BAD_STREAM_HEADER); - if (x == NULL || PyDict_SetItemString(d, "BAD_STREAM_HEADER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_STRING_POINTER - x = PyInt_FromLong(CL_BAD_STRING_POINTER); - if (x == NULL || PyDict_SetItemString(d, "BAD_STRING_POINTER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BAD_TEXT_STRING_PTR - x = PyInt_FromLong(CL_BAD_TEXT_STRING_PTR); - if (x == NULL || PyDict_SetItemString(d, "BAD_TEXT_STRING_PTR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BEST_FIT - x = PyInt_FromLong(CL_BEST_FIT); - if (x == NULL || PyDict_SetItemString(d, "BEST_FIT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BIDIRECTIONAL - x = PyInt_FromLong(CL_BIDIRECTIONAL); - if (x == NULL || PyDict_SetItemString(d, "BIDIRECTIONAL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BITRATE - x = PyInt_FromLong(CL_BITRATE); - if (x == NULL || PyDict_SetItemString(d, "BITRATE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BITRATE_POLICY - x = PyInt_FromLong(CL_BITRATE_POLICY); - if (x == NULL || PyDict_SetItemString(d, "BITRATE_POLICY", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BITRATE_TARGET - x = PyInt_FromLong(CL_BITRATE_TARGET); - if (x == NULL || PyDict_SetItemString(d, "BITRATE_TARGET", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BITS_PER_COMPONENT - x = PyInt_FromLong(CL_BITS_PER_COMPONENT); - if (x == NULL || PyDict_SetItemString(d, "BITS_PER_COMPONENT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BLENDING - x = PyInt_FromLong(CL_BLENDING); - if (x == NULL || PyDict_SetItemString(d, "BLENDING", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BLOCK_SIZE - x = PyInt_FromLong(CL_BLOCK_SIZE); - if (x == NULL || PyDict_SetItemString(d, "BLOCK_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BOTTOM_UP - x = PyInt_FromLong(CL_BOTTOM_UP); - if (x == NULL || PyDict_SetItemString(d, "BOTTOM_UP", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BUFFER_NOT_CREATED - x = PyInt_FromLong(CL_BUFFER_NOT_CREATED); - if (x == NULL || PyDict_SetItemString(d, "BUFFER_NOT_CREATED", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BUF_COMPRESSED - x = PyInt_FromLong(CL_BUF_COMPRESSED); - if (x == NULL || PyDict_SetItemString(d, "BUF_COMPRESSED", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BUF_DATA - x = PyInt_FromLong(CL_BUF_DATA); - if (x == NULL || PyDict_SetItemString(d, "BUF_DATA", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_BUF_FRAME - x = PyInt_FromLong(CL_BUF_FRAME); - if (x == NULL || PyDict_SetItemString(d, "BUF_FRAME", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_CHANNEL_POLICY - x = PyInt_FromLong(CL_CHANNEL_POLICY); - if (x == NULL || PyDict_SetItemString(d, "CHANNEL_POLICY", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_CHROMA_THRESHOLD - x = PyInt_FromLong(CL_CHROMA_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "CHROMA_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_CODEC - x = PyInt_FromLong(CL_CODEC); - if (x == NULL || PyDict_SetItemString(d, "CODEC", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COMPONENTS - x = PyInt_FromLong(CL_COMPONENTS); - if (x == NULL || PyDict_SetItemString(d, "COMPONENTS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COMPRESSED_BUFFER_SIZE - x = PyInt_FromLong(CL_COMPRESSED_BUFFER_SIZE); - if (x == NULL || PyDict_SetItemString(d, "COMPRESSED_BUFFER_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COMPRESSION_RATIO - x = PyInt_FromLong(CL_COMPRESSION_RATIO); - if (x == NULL || PyDict_SetItemString(d, "COMPRESSION_RATIO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COMPRESSOR - x = PyInt_FromLong(CL_COMPRESSOR); - if (x == NULL || PyDict_SetItemString(d, "COMPRESSOR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_CONTINUOUS_BLOCK - x = PyInt_FromLong(CL_CONTINUOUS_BLOCK); - if (x == NULL || PyDict_SetItemString(d, "CONTINUOUS_BLOCK", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_CONTINUOUS_NONBLOCK - x = PyInt_FromLong(CL_CONTINUOUS_NONBLOCK); - if (x == NULL || PyDict_SetItemString(d, "CONTINUOUS_NONBLOCK", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COSMO_CODEC_CONTROL - x = PyInt_FromLong(CL_COSMO_CODEC_CONTROL); - if (x == NULL || PyDict_SetItemString(d, "COSMO_CODEC_CONTROL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COSMO_NUM_PARAMS - x = PyInt_FromLong(CL_COSMO_NUM_PARAMS); - if (x == NULL || PyDict_SetItemString(d, "COSMO_NUM_PARAMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COSMO_VALUE_BASE - x = PyInt_FromLong(CL_COSMO_VALUE_BASE); - if (x == NULL || PyDict_SetItemString(d, "COSMO_VALUE_BASE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COSMO_VIDEO_MANUAL_CONTROL - x = PyInt_FromLong(CL_COSMO_VIDEO_MANUAL_CONTROL); - if (x == NULL || PyDict_SetItemString(d, "COSMO_VIDEO_MANUAL_CONTROL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_COSMO_VIDEO_TRANSFER_MODE - x = PyInt_FromLong(CL_COSMO_VIDEO_TRANSFER_MODE); - if (x == NULL || PyDict_SetItemString(d, "COSMO_VIDEO_TRANSFER_MODE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_DATA - x = PyInt_FromLong(CL_DATA); - if (x == NULL || PyDict_SetItemString(d, "DATA", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_DECOMPRESSOR - x = PyInt_FromLong(CL_DECOMPRESSOR); - if (x == NULL || PyDict_SetItemString(d, "DECOMPRESSOR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_DSO_ERROR - x = PyInt_FromLong(CL_DSO_ERROR); - if (x == NULL || PyDict_SetItemString(d, "DSO_ERROR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_EDGE_THRESHOLD - x = PyInt_FromLong(CL_EDGE_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "EDGE_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ENABLE_IMAGEINFO - x = PyInt_FromLong(CL_ENABLE_IMAGEINFO); - if (x == NULL || PyDict_SetItemString(d, "ENABLE_IMAGEINFO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_END_OF_SEQUENCE - x = PyInt_FromLong(CL_END_OF_SEQUENCE); - if (x == NULL || PyDict_SetItemString(d, "END_OF_SEQUENCE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ENUM_VALUE - x = PyInt_FromLong(CL_ENUM_VALUE); - if (x == NULL || PyDict_SetItemString(d, "ENUM_VALUE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_EXACT_COMPRESSION_RATIO - x = PyInt_FromLong(CL_EXACT_COMPRESSION_RATIO); - if (x == NULL || PyDict_SetItemString(d, "EXACT_COMPRESSION_RATIO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_EXTERNAL_DEVICE - x = PyInt_FromLong((long) CL_EXTERNAL_DEVICE); - if (x == NULL || PyDict_SetItemString(d, "EXTERNAL_DEVICE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FLOATING_ENUM_VALUE - x = PyInt_FromLong(CL_FLOATING_ENUM_VALUE); - if (x == NULL || PyDict_SetItemString(d, "FLOATING_ENUM_VALUE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FLOATING_RANGE_VALUE - x = PyInt_FromLong(CL_FLOATING_RANGE_VALUE); - if (x == NULL || PyDict_SetItemString(d, "FLOATING_RANGE_VALUE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT - x = PyInt_FromLong(CL_FORMAT); - if (x == NULL || PyDict_SetItemString(d, "FORMAT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_ABGR - x = PyInt_FromLong(CL_FORMAT_ABGR); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_ABGR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_BGR - x = PyInt_FromLong(CL_FORMAT_BGR); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_BGR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_BGR233 - x = PyInt_FromLong(CL_FORMAT_BGR233); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_BGR233", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_GRAYSCALE - x = PyInt_FromLong(CL_FORMAT_GRAYSCALE); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_GRAYSCALE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_MONO - x = PyInt_FromLong(CL_FORMAT_MONO); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_MONO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_RBG323 - x = PyInt_FromLong(CL_FORMAT_RBG323); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_RBG323", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_STEREO_INTERLEAVED - x = PyInt_FromLong(CL_FORMAT_STEREO_INTERLEAVED); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_STEREO_INTERLEAVED", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_XBGR - x = PyInt_FromLong(CL_FORMAT_XBGR); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_XBGR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_YCbCr - x = PyInt_FromLong(CL_FORMAT_YCbCr); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_YCbCr", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_YCbCr422 - x = PyInt_FromLong(CL_FORMAT_YCbCr422); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_YCbCr422", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FORMAT_YCbCr422DC - x = PyInt_FromLong(CL_FORMAT_YCbCr422DC); - if (x == NULL || PyDict_SetItemString(d, "FORMAT_YCbCr422DC", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAME - x = PyInt_FromLong(CL_FRAME); - if (x == NULL || PyDict_SetItemString(d, "FRAME", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAMES_PER_CHUNK - x = PyInt_FromLong(CL_FRAMES_PER_CHUNK); - if (x == NULL || PyDict_SetItemString(d, "FRAMES_PER_CHUNK", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAME_BUFFER_SIZE - x = PyInt_FromLong(CL_FRAME_BUFFER_SIZE); - if (x == NULL || PyDict_SetItemString(d, "FRAME_BUFFER_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAME_BUFFER_SIZE_ZERO - x = PyInt_FromLong(CL_FRAME_BUFFER_SIZE_ZERO); - if (x == NULL || PyDict_SetItemString(d, "FRAME_BUFFER_SIZE_ZERO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAME_INDEX - x = PyInt_FromLong(CL_FRAME_INDEX); - if (x == NULL || PyDict_SetItemString(d, "FRAME_INDEX", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAME_RATE - x = PyInt_FromLong(CL_FRAME_RATE); - if (x == NULL || PyDict_SetItemString(d, "FRAME_RATE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAME_SIZE - x = PyInt_FromLong(CL_FRAME_SIZE); - if (x == NULL || PyDict_SetItemString(d, "FRAME_SIZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_FRAME_TYPE - x = PyInt_FromLong(CL_FRAME_TYPE); - if (x == NULL || PyDict_SetItemString(d, "FRAME_TYPE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_G711_ALAW - x = PyInt_FromLong(CL_G711_ALAW); - if (x == NULL || PyDict_SetItemString(d, "G711_ALAW", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_G711_ALAW_SOFTWARE - x = PyInt_FromLong(CL_G711_ALAW_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "G711_ALAW_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_G711_ULAW - x = PyInt_FromLong(CL_G711_ULAW); - if (x == NULL || PyDict_SetItemString(d, "G711_ULAW", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_G711_ULAW_SOFTWARE - x = PyInt_FromLong(CL_G711_ULAW_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "G711_ULAW_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_GRAYSCALE - x = PyInt_FromLong(CL_GRAYSCALE); - if (x == NULL || PyDict_SetItemString(d, "GRAYSCALE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_HDCC - x = PyInt_FromLong(CL_HDCC); - if (x == NULL || PyDict_SetItemString(d, "HDCC", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_HDCC_SAMPLES_PER_TILE - x = PyInt_FromLong(CL_HDCC_SAMPLES_PER_TILE); - if (x == NULL || PyDict_SetItemString(d, "HDCC_SAMPLES_PER_TILE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_HDCC_SOFTWARE - x = PyInt_FromLong(CL_HDCC_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "HDCC_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_HDCC_TILE_THRESHOLD - x = PyInt_FromLong(CL_HDCC_TILE_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "HDCC_TILE_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_HEADER_START_CODE - x = PyInt_FromLong(CL_HEADER_START_CODE); - if (x == NULL || PyDict_SetItemString(d, "HEADER_START_CODE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMAGEINFO_FIELDMASK - x = PyInt_FromLong(CL_IMAGEINFO_FIELDMASK); - if (x == NULL || PyDict_SetItemString(d, "IMAGEINFO_FIELDMASK", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMAGE_CROP_BOTTOM - x = PyInt_FromLong(CL_IMAGE_CROP_BOTTOM); - if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_BOTTOM", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMAGE_CROP_LEFT - x = PyInt_FromLong(CL_IMAGE_CROP_LEFT); - if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_LEFT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMAGE_CROP_RIGHT - x = PyInt_FromLong(CL_IMAGE_CROP_RIGHT); - if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_RIGHT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMAGE_CROP_TOP - x = PyInt_FromLong(CL_IMAGE_CROP_TOP); - if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_TOP", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMAGE_HEIGHT - x = PyInt_FromLong(CL_IMAGE_HEIGHT); - if (x == NULL || PyDict_SetItemString(d, "IMAGE_HEIGHT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMAGE_WIDTH - x = PyInt_FromLong(CL_IMAGE_WIDTH); - if (x == NULL || PyDict_SetItemString(d, "IMAGE_WIDTH", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMPACT_CODEC_CONTROL - x = PyInt_FromLong(CL_IMPACT_CODEC_CONTROL); - if (x == NULL || PyDict_SetItemString(d, "IMPACT_CODEC_CONTROL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMPACT_FRAME_INTERLEAVE - x = PyInt_FromLong(CL_IMPACT_FRAME_INTERLEAVE); - if (x == NULL || PyDict_SetItemString(d, "IMPACT_FRAME_INTERLEAVE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_IMPACT_NUM_PARAMS - x = PyInt_FromLong(CL_IMPACT_NUM_PARAMS); - if (x == NULL || PyDict_SetItemString(d, "IMPACT_NUM_PARAMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_INTERNAL_FORMAT - x = PyInt_FromLong(CL_INTERNAL_FORMAT); - if (x == NULL || PyDict_SetItemString(d, "INTERNAL_FORMAT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_INTERNAL_IMAGE_HEIGHT - x = PyInt_FromLong(CL_INTERNAL_IMAGE_HEIGHT); - if (x == NULL || PyDict_SetItemString(d, "INTERNAL_IMAGE_HEIGHT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_INTERNAL_IMAGE_WIDTH - x = PyInt_FromLong(CL_INTERNAL_IMAGE_WIDTH); - if (x == NULL || PyDict_SetItemString(d, "INTERNAL_IMAGE_WIDTH", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_INTRA - x = PyInt_FromLong(CL_INTRA); - if (x == NULL || PyDict_SetItemString(d, "INTRA", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG - x = PyInt_FromLong(CL_JPEG); - if (x == NULL || PyDict_SetItemString(d, "JPEG", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_COSMO - x = PyInt_FromLong(CL_JPEG_COSMO); - if (x == NULL || PyDict_SetItemString(d, "JPEG_COSMO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_ERROR - x = PyInt_FromLong(CL_JPEG_ERROR); - if (x == NULL || PyDict_SetItemString(d, "JPEG_ERROR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_IMPACT - x = PyInt_FromLong(CL_JPEG_IMPACT); - if (x == NULL || PyDict_SetItemString(d, "JPEG_IMPACT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_NUM_PARAMS - x = PyInt_FromLong(CL_JPEG_NUM_PARAMS); - if (x == NULL || PyDict_SetItemString(d, "JPEG_NUM_PARAMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_QUALITY_FACTOR - x = PyInt_FromLong(CL_JPEG_QUALITY_FACTOR); - if (x == NULL || PyDict_SetItemString(d, "JPEG_QUALITY_FACTOR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_QUANTIZATION_TABLES - x = PyInt_FromLong(CL_JPEG_QUANTIZATION_TABLES); - if (x == NULL || PyDict_SetItemString(d, "JPEG_QUANTIZATION_TABLES", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_SOFTWARE - x = PyInt_FromLong(CL_JPEG_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "JPEG_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_JPEG_STREAM_HEADERS - x = PyInt_FromLong(CL_JPEG_STREAM_HEADERS); - if (x == NULL || PyDict_SetItemString(d, "JPEG_STREAM_HEADERS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_KEYFRAME - x = PyInt_FromLong(CL_KEYFRAME); - if (x == NULL || PyDict_SetItemString(d, "KEYFRAME", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_KEYFRAME_DISTANCE - x = PyInt_FromLong(CL_KEYFRAME_DISTANCE); - if (x == NULL || PyDict_SetItemString(d, "KEYFRAME_DISTANCE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_LAST_FRAME_INDEX - x = PyInt_FromLong(CL_LAST_FRAME_INDEX); - if (x == NULL || PyDict_SetItemString(d, "LAST_FRAME_INDEX", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_LAYER - x = PyInt_FromLong(CL_LAYER); - if (x == NULL || PyDict_SetItemString(d, "LAYER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_LUMA_THRESHOLD - x = PyInt_FromLong(CL_LUMA_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "LUMA_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MAX_NUMBER_OF_AUDIO_ALGORITHMS - x = PyInt_FromLong(CL_MAX_NUMBER_OF_AUDIO_ALGORITHMS); - if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_AUDIO_ALGORITHMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MAX_NUMBER_OF_FORMATS - x = PyInt_FromLong(CL_MAX_NUMBER_OF_FORMATS); - if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_FORMATS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MAX_NUMBER_OF_ORIGINAL_FORMATS - x = PyInt_FromLong(CL_MAX_NUMBER_OF_ORIGINAL_FORMATS); - if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_ORIGINAL_FORMATS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MAX_NUMBER_OF_PARAMS - x = PyInt_FromLong(CL_MAX_NUMBER_OF_PARAMS); - if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_PARAMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MAX_NUMBER_OF_VIDEO_ALGORITHMS - x = PyInt_FromLong(CL_MAX_NUMBER_OF_VIDEO_ALGORITHMS); - if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_VIDEO_ALGORITHMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MONO - x = PyInt_FromLong(CL_MONO); - if (x == NULL || PyDict_SetItemString(d, "MONO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_AWARE - x = PyInt_FromLong(CL_MPEG1_AUDIO_AWARE); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_AWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_LAYER - x = PyInt_FromLong(CL_MPEG1_AUDIO_LAYER); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_LAYER", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_LAYER_I - x = PyInt_FromLong(CL_MPEG1_AUDIO_LAYER_I); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_LAYER_I", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_LAYER_II - x = PyInt_FromLong(CL_MPEG1_AUDIO_LAYER_II); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_LAYER_II", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_MODE - x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_MODE_DUAL - x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_DUAL); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_DUAL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_MODE_JOINT - x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_JOINT); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_JOINT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_MODE_SINGLE - x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_SINGLE); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_SINGLE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_MODE_STEREO - x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_STEREO); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_STEREO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_AUDIO_SOFTWARE - x = PyInt_FromLong(CL_MPEG1_AUDIO_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_END_OF_STREAM - x = PyInt_FromLong(CL_MPEG1_END_OF_STREAM); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_END_OF_STREAM", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_ERROR - x = PyInt_FromLong(CL_MPEG1_ERROR); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_ERROR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_NUM_PARAMS - x = PyInt_FromLong(CL_MPEG1_NUM_PARAMS); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_NUM_PARAMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_M - x = PyInt_FromLong(CL_MPEG1_VIDEO_M); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_M", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_X - x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_X); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_X", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_Y - x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_Y); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_Y", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_X - x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_X); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_X", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_Y - x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_Y); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_Y", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_N - x = PyInt_FromLong(CL_MPEG1_VIDEO_N); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_N", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_SOFTNESS - x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_SOFTNESS_MAXIMUM - x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS_MAXIMUM); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS_MAXIMUM", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_SOFTNESS_MEDIUM - x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS_MEDIUM); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS_MEDIUM", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_SOFTNESS_NONE - x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS_NONE); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS_NONE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG1_VIDEO_SOFTWARE - x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MPEG_VIDEO - x = PyInt_FromLong(CL_MPEG_VIDEO); - if (x == NULL || PyDict_SetItemString(d, "MPEG_VIDEO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MULTIRATE_AWARE - x = PyInt_FromLong(CL_MULTIRATE_AWARE); - if (x == NULL || PyDict_SetItemString(d, "MULTIRATE_AWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC1 - x = PyInt_FromLong(CL_MVC1); - if (x == NULL || PyDict_SetItemString(d, "MVC1", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC1_SOFTWARE - x = PyInt_FromLong(CL_MVC1_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "MVC1_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2 - x = PyInt_FromLong(CL_MVC2); - if (x == NULL || PyDict_SetItemString(d, "MVC2", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_BLENDING - x = PyInt_FromLong(CL_MVC2_BLENDING); - if (x == NULL || PyDict_SetItemString(d, "MVC2_BLENDING", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_BLENDING_OFF - x = PyInt_FromLong(CL_MVC2_BLENDING_OFF); - if (x == NULL || PyDict_SetItemString(d, "MVC2_BLENDING_OFF", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_BLENDING_ON - x = PyInt_FromLong(CL_MVC2_BLENDING_ON); - if (x == NULL || PyDict_SetItemString(d, "MVC2_BLENDING_ON", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_CHROMA_THRESHOLD - x = PyInt_FromLong(CL_MVC2_CHROMA_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "MVC2_CHROMA_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_EDGE_THRESHOLD - x = PyInt_FromLong(CL_MVC2_EDGE_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "MVC2_EDGE_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_ERROR - x = PyInt_FromLong(CL_MVC2_ERROR); - if (x == NULL || PyDict_SetItemString(d, "MVC2_ERROR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_LUMA_THRESHOLD - x = PyInt_FromLong(CL_MVC2_LUMA_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "MVC2_LUMA_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC2_SOFTWARE - x = PyInt_FromLong(CL_MVC2_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "MVC2_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC3_QUALITY_LEVEL - x = PyInt_FromLong(CL_MVC3_QUALITY_LEVEL); - if (x == NULL || PyDict_SetItemString(d, "MVC3_QUALITY_LEVEL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_MVC3_SOFTWARE - x = PyInt_FromLong(CL_MVC3_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "MVC3_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NEXT_NOT_AVAILABLE - x = PyInt_FromLong(CL_NEXT_NOT_AVAILABLE); - if (x == NULL || PyDict_SetItemString(d, "NEXT_NOT_AVAILABLE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NOISE_MARGIN - x = PyInt_FromLong(CL_NOISE_MARGIN); - if (x == NULL || PyDict_SetItemString(d, "NOISE_MARGIN", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NONE - x = PyInt_FromLong(CL_NONE); - if (x == NULL || PyDict_SetItemString(d, "NONE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NUMBER_OF_FORMATS - x = PyInt_FromLong(CL_NUMBER_OF_FORMATS); - if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_FORMATS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NUMBER_OF_FRAMES - x = PyInt_FromLong(CL_NUMBER_OF_FRAMES); - if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_FRAMES", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NUMBER_OF_PARAMS - x = PyInt_FromLong(CL_NUMBER_OF_PARAMS); - if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_PARAMS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NUMBER_OF_PARAMS_FREEZE - x = PyInt_FromLong(CL_NUMBER_OF_PARAMS_FREEZE); - if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_PARAMS_FREEZE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_NUMBER_OF_VIDEO_FORMATS - x = PyInt_FromLong(CL_NUMBER_OF_VIDEO_FORMATS); - if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_VIDEO_FORMATS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ORIENTATION - x = PyInt_FromLong(CL_ORIENTATION); - if (x == NULL || PyDict_SetItemString(d, "ORIENTATION", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ORIGINAL_FORMAT - x = PyInt_FromLong(CL_ORIGINAL_FORMAT); - if (x == NULL || PyDict_SetItemString(d, "ORIGINAL_FORMAT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_PARAM_OUT_OF_RANGE - x = PyInt_FromLong(CL_PARAM_OUT_OF_RANGE); - if (x == NULL || PyDict_SetItemString(d, "PARAM_OUT_OF_RANGE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_PIXEL_ASPECT - x = PyInt_FromLong(CL_PIXEL_ASPECT); - if (x == NULL || PyDict_SetItemString(d, "PIXEL_ASPECT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_PREDICTED - x = PyInt_FromLong(CL_PREDICTED); - if (x == NULL || PyDict_SetItemString(d, "PREDICTED", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_PREROLL - x = PyInt_FromLong(CL_PREROLL); - if (x == NULL || PyDict_SetItemString(d, "PREROLL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_QUALITY_FACTOR - x = PyInt_FromLong(CL_QUALITY_FACTOR); - if (x == NULL || PyDict_SetItemString(d, "QUALITY_FACTOR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_QUALITY_LEVEL - x = PyInt_FromLong(CL_QUALITY_LEVEL); - if (x == NULL || PyDict_SetItemString(d, "QUALITY_LEVEL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_QUALITY_SPATIAL - x = PyInt_FromLong(CL_QUALITY_SPATIAL); - if (x == NULL || PyDict_SetItemString(d, "QUALITY_SPATIAL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_QUALITY_TEMPORAL - x = PyInt_FromLong(CL_QUALITY_TEMPORAL); - if (x == NULL || PyDict_SetItemString(d, "QUALITY_TEMPORAL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_QUANTIZATION_TABLES - x = PyInt_FromLong(CL_QUANTIZATION_TABLES); - if (x == NULL || PyDict_SetItemString(d, "QUANTIZATION_TABLES", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RANGE_VALUE - x = PyInt_FromLong(CL_RANGE_VALUE); - if (x == NULL || PyDict_SetItemString(d, "RANGE_VALUE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RGB - x = PyInt_FromLong(CL_RGB); - if (x == NULL || PyDict_SetItemString(d, "RGB", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RGB332 - x = PyInt_FromLong(CL_RGB332); - if (x == NULL || PyDict_SetItemString(d, "RGB332", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RGB8 - x = PyInt_FromLong(CL_RGB8); - if (x == NULL || PyDict_SetItemString(d, "RGB8", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RGBA - x = PyInt_FromLong(CL_RGBA); - if (x == NULL || PyDict_SetItemString(d, "RGBA", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RGBX - x = PyInt_FromLong(CL_RGBX); - if (x == NULL || PyDict_SetItemString(d, "RGBX", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RLE - x = PyInt_FromLong(CL_RLE); - if (x == NULL || PyDict_SetItemString(d, "RLE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RLE24 - x = PyInt_FromLong(CL_RLE24); - if (x == NULL || PyDict_SetItemString(d, "RLE24", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RLE24_SOFTWARE - x = PyInt_FromLong(CL_RLE24_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "RLE24_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RLE_SOFTWARE - x = PyInt_FromLong(CL_RLE_SOFTWARE); - if (x == NULL || PyDict_SetItemString(d, "RLE_SOFTWARE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RTR - x = PyInt_FromLong(CL_RTR); - if (x == NULL || PyDict_SetItemString(d, "RTR", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RTR1 - x = PyInt_FromLong(CL_RTR1); - if (x == NULL || PyDict_SetItemString(d, "RTR1", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_RTR_QUALITY_LEVEL - x = PyInt_FromLong(CL_RTR_QUALITY_LEVEL); - if (x == NULL || PyDict_SetItemString(d, "RTR_QUALITY_LEVEL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_SAMPLES_PER_TILE - x = PyInt_FromLong(CL_SAMPLES_PER_TILE); - if (x == NULL || PyDict_SetItemString(d, "SAMPLES_PER_TILE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_SCHEME_BUSY - x = PyInt_FromLong(CL_SCHEME_BUSY); - if (x == NULL || PyDict_SetItemString(d, "SCHEME_BUSY", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_SCHEME_NOT_AVAILABLE - x = PyInt_FromLong(CL_SCHEME_NOT_AVAILABLE); - if (x == NULL || PyDict_SetItemString(d, "SCHEME_NOT_AVAILABLE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_SPEED - x = PyInt_FromLong(CL_SPEED); - if (x == NULL || PyDict_SetItemString(d, "SPEED", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_STEREO_INTERLEAVED - x = PyInt_FromLong(CL_STEREO_INTERLEAVED); - if (x == NULL || PyDict_SetItemString(d, "STEREO_INTERLEAVED", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_STREAM_HEADERS - x = PyInt_FromLong(CL_STREAM_HEADERS); - if (x == NULL || PyDict_SetItemString(d, "STREAM_HEADERS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_TILE_THRESHOLD - x = PyInt_FromLong(CL_TILE_THRESHOLD); - if (x == NULL || PyDict_SetItemString(d, "TILE_THRESHOLD", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_TOP_DOWN - x = PyInt_FromLong(CL_TOP_DOWN); - if (x == NULL || PyDict_SetItemString(d, "TOP_DOWN", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_ULAW - x = PyInt_FromLong(CL_ULAW); - if (x == NULL || PyDict_SetItemString(d, "ULAW", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_UNCOMPRESSED - x = PyInt_FromLong(CL_UNCOMPRESSED); - if (x == NULL || PyDict_SetItemString(d, "UNCOMPRESSED", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_UNCOMPRESSED_AUDIO - x = PyInt_FromLong(CL_UNCOMPRESSED_AUDIO); - if (x == NULL || PyDict_SetItemString(d, "UNCOMPRESSED_AUDIO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_UNCOMPRESSED_VIDEO - x = PyInt_FromLong(CL_UNCOMPRESSED_VIDEO); - if (x == NULL || PyDict_SetItemString(d, "UNCOMPRESSED_VIDEO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_UNKNOWN_SCHEME - x = PyInt_FromLong(CL_UNKNOWN_SCHEME); - if (x == NULL || PyDict_SetItemString(d, "UNKNOWN_SCHEME", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_VIDEO - x = PyInt_FromLong(CL_VIDEO); - if (x == NULL || PyDict_SetItemString(d, "VIDEO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_Y - x = PyInt_FromLong(CL_Y); - if (x == NULL || PyDict_SetItemString(d, "Y", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YCbCr - x = PyInt_FromLong(CL_YCbCr); - if (x == NULL || PyDict_SetItemString(d, "YCbCr", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YCbCr422 - x = PyInt_FromLong(CL_YCbCr422); - if (x == NULL || PyDict_SetItemString(d, "YCbCr422", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YCbCr422DC - x = PyInt_FromLong(CL_YCbCr422DC); - if (x == NULL || PyDict_SetItemString(d, "YCbCr422DC", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YCbCr422HC - x = PyInt_FromLong(CL_YCbCr422HC); - if (x == NULL || PyDict_SetItemString(d, "YCbCr422HC", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YUV - x = PyInt_FromLong(CL_YUV); - if (x == NULL || PyDict_SetItemString(d, "YUV", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YUV422 - x = PyInt_FromLong(CL_YUV422); - if (x == NULL || PyDict_SetItemString(d, "YUV422", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YUV422DC - x = PyInt_FromLong(CL_YUV422DC); - if (x == NULL || PyDict_SetItemString(d, "YUV422DC", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef CL_YUV422HC - x = PyInt_FromLong(CL_YUV422HC); - if (x == NULL || PyDict_SetItemString(d, "YUV422HC", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_STEREO - x = PyInt_FromLong(AWCMP_STEREO); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_STEREO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_JOINT_STEREO - x = PyInt_FromLong(AWCMP_JOINT_STEREO); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_JOINT_STEREO", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_INDEPENDENT - x = PyInt_FromLong(AWCMP_INDEPENDENT); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_INDEPENDENT", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_FIXED_RATE - x = PyInt_FromLong(AWCMP_FIXED_RATE); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_FIXED_RATE", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_CONST_QUAL - x = PyInt_FromLong(AWCMP_CONST_QUAL); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_CONST_QUAL", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_LOSSLESS - x = PyInt_FromLong(AWCMP_LOSSLESS); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_LOSSLESS", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_MPEG_LAYER_I - x = PyInt_FromLong(AWCMP_MPEG_LAYER_I); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_MPEG_LAYER_I", x) < 0) - return; - Py_DECREF(x); -#endif -#ifdef AWCMP_MPEG_LAYER_II - x = PyInt_FromLong(AWCMP_MPEG_LAYER_II); - if (x == NULL || PyDict_SetItemString(d, "AWCMP_MPEG_LAYER_II", x) < 0) - return; - Py_DECREF(x); -#endif - - (void) clSetErrorHandler(cl_ErrorHandler); -} diff --git a/Modules/flmodule.c b/Modules/flmodule.c deleted file mode 100644 index e507c9f..0000000 --- a/Modules/flmodule.c +++ /dev/null @@ -1,2139 +0,0 @@ -/* FL module -- interface to Mark Overmars' FORMS Library. */ - -/* This code works with FORMS version 2.2 (if you defined - OBSOLETE_FORMS_CALLS), and 2.3. - FORMS can be ftp'ed from ftp.cs.ruu.nl (131.211.80.17), directory - /pub/SGI/FORMS. */ - -/* A half-hearted attempt has been made to allow programs using this - * module to exploit parallelism (through the threads module). No provisions - * have been made for multiple threads to use this module at the same time, - * though. So, a program with a forms thread and a non-forms thread will work - * fine but a program with two threads using forms will probably crash (unless - * the program takes precaution to ensure that only one thread can be in - * this module at any time). This will have to be fixed some time. - * (A fix will probably also have to synchronize with the gl module). - */ - -#include "Python.h" -#include "forms.h" -#include "structmember.h" - -/* Generic Forms Objects */ - -typedef struct { - PyObject_HEAD - FL_OBJECT *ob_generic; - PyMethodDef *ob_methods; - PyObject *ob_callback; - PyObject *ob_callback_arg; -} genericobject; - -static PyTypeObject GenericObjecttype; - -#define is_genericobject(g) ((g)->ob_type == &GenericObjecttype) - -/* List of all objects (XXX this should be a hash table on address...) */ - -static PyObject *allgenerics = NULL; -static int nfreeslots = 0; - -/* Add an object to the list of known objects */ - -static void -knowgeneric(genericobject *g) -{ - int i, n; - /* Create the list if it doesn't already exist */ - if (allgenerics == NULL) { - allgenerics = PyList_New(0); - if (allgenerics == NULL) { - PyErr_Clear(); - return; /* Too bad, live without allgenerics... */ - } - } - if (nfreeslots > 0) { - /* Search the list for reusable slots (NULL items) */ - /* XXX This can be made faster! */ - n = PyList_Size(allgenerics); - for (i = 0; i < n; i++) { - if (PyList_GetItem(allgenerics, i) == NULL) { - Py_INCREF(g); - PyList_SetItem(allgenerics, i, (PyObject *)g); - nfreeslots--; - return; - } - } - /* Strange... no free slots found... */ - nfreeslots = 0; - } - /* No free entries, append new item to the end */ - PyList_Append(allgenerics, (PyObject *)g); -} - -/* Find an object in the list of known objects */ - -static genericobject * -findgeneric(FL_OBJECT *generic) -{ - int i, n; - genericobject *g; - - if (allgenerics == NULL) - return NULL; /* No objects known yet */ - n = PyList_Size(allgenerics); - for (i = 0; i < n; i++) { - g = (genericobject *)PyList_GetItem(allgenerics, i); - if (g != NULL && g->ob_generic == generic) - return g; - } - return NULL; /* Unknown object */ -} - -/* Remove an object from the list of known objects */ - -static void -forgetgeneric(genericobject *g) -{ - int i, n; - - Py_XDECREF(g->ob_callback); - g->ob_callback = NULL; - Py_XDECREF(g->ob_callback_arg); - g->ob_callback_arg = NULL; - if (allgenerics == NULL) - return; /* No objects known yet */ - n = PyList_Size(allgenerics); - for (i = 0; i < n; i++) { - if (g == (genericobject *)PyList_GetItem(allgenerics, i)) { - PyList_SetItem(allgenerics, i, (PyObject *)NULL); - nfreeslots++; - break; - } - } -} - -/* Called when a form is about to be freed -- - remove all the objects that we know about from it. */ - -static void -releaseobjects(FL_FORM *form) -{ - int i, n; - genericobject *g; - - if (allgenerics == NULL) - return; /* No objects known yet */ - n = PyList_Size(allgenerics); - for (i = 0; i < n; i++) { - g = (genericobject *)PyList_GetItem(allgenerics, i); - if (g != NULL && g->ob_generic->form == form) { - fl_delete_object(g->ob_generic); - /* The object is now unreachable for - do_forms and check_forms, so - delete it from the list of known objects */ - Py_XDECREF(g->ob_callback); - g->ob_callback = NULL; - Py_XDECREF(g->ob_callback_arg); - g->ob_callback_arg = NULL; - PyList_SetItem(allgenerics, i, (PyObject *)NULL); - nfreeslots++; - } - } -} - - -/* Methods of generic objects */ - -static PyObject * -generic_set_call_back(genericobject *g, PyObject *args) -{ - if (PyTuple_GET_SIZE(args) == 0) { - Py_XDECREF(g->ob_callback); - Py_XDECREF(g->ob_callback_arg); - g->ob_callback = NULL; - g->ob_callback_arg = NULL; - } - else { - PyObject *a, *b; - if (!PyArg_UnpackTuple(args, "set_call_back", 2, 2, &a, &b) - return NULL; - Py_XDECREF(g->ob_callback); - Py_XDECREF(g->ob_callback_arg); - g->ob_callback = a; - Py_INCREF(g->ob_callback); - g->ob_callback_arg = b; - Py_INCREF(g->ob_callback_arg); - } - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -generic_call(genericobject *g, void (*func)(FL_OBJECT *)) -{ - (*func)(g->ob_generic); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -generic_delete_object(genericobject *g) -{ - PyObject *res; - res = generic_call(g, fl_delete_object); - if (res != NULL) - forgetgeneric(g); - return res; -} - -static PyObject * -generic_show_object(genericobject *g) -{ - return generic_call(g, fl_show_object); -} - -static PyObject * -generic_hide_object(genericobject *g) -{ - return generic_call(g, fl_hide_object); -} - -static PyObject * -generic_redraw_object(genericobject *g) -{ - return generic_call(g, fl_redraw_object); -} - -#ifdef OBSOLETE_FORMS_CALLS - - /* (un)freeze_object() are obsolete in FORMS 2.2 and unsupported - in 2.3. Since there's no foolproof way to tell which version we're - using, we omit them unconditionally. */ - -static PyObject * -generic_freeze_object(genericobject *g) -{ - return generic_call(g, fl_freeze_object); -} - -static PyObject * -generic_unfreeze_object(genericobject *g) -{ - return generic_call(g, fl_unfreeze_object); -} - -#endif /* OBSOLETE_FORMS_CALLS */ - -static PyObject * -generic_activate_object(genericobject *g) -{ - return generic_call(g, fl_activate_object); -} - -static PyObject * -generic_deactivate_object(genericobject *g) -{ - return generic_call(g, fl_deactivate_object); -} - -static PyObject * -generic_set_object_shortcut(genericobject *g, PyObject *args) -{ - char *str; - if (!PyArg_ParseTuple(args, "s:set_object_shortcut", &str)) - return NULL; - fl_set_object_shortcut(g->ob_generic, str); - Py_INCREF(Py_None); - return Py_None; -} - -static PyMethodDef generic_methods[] = { - {"set_call_back", (PyCFunction)generic_set_call_back, METH_VARARGS}, - {"delete_object", (PyCFunction)generic_delete_object, METH_NOARGS}, - {"show_object", (PyCFunction)generic_show_object, METH_NOARGS}, - {"hide_object", (PyCFunction)generic_hide_object, METH_NOARGS}, - {"redraw_object", (PyCFunction)generic_redraw_object, METH_NOARGS}, -#ifdef OBSOLETE_FORMS_CALLS - {"freeze_object", (PyCFunction)generic_freeze_object, METH_NOARGS}, - {"unfreeze_object", (PyCFunction)generic_unfreeze_object, METH_NOARGS}, -#endif - {"activate_object", (PyCFunction)generic_activate_object, METH_NOARGS}, - {"deactivate_object", (PyCFunction)generic_deactivate_object, METH_NOARGS}, - {"set_object_shortcut", (PyCFunction)generic_set_object_shortcut, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - -static void -generic_dealloc(genericobject *g) -{ - fl_free_object(g->ob_generic); - Py_XDECREF(g->ob_callback); - Py_XDECREF(g->ob_callback_arg); - PyObject_Del(g); -} - -#define OFF(x) offsetof(FL_OBJECT, x) - -static struct memberlist generic_memberlist[] = { - {"objclass", T_INT, OFF(objclass), RO}, - {"type", T_INT, OFF(type), RO}, - {"boxtype", T_INT, OFF(boxtype)}, - {"x", T_FLOAT, OFF(x)}, - {"y", T_FLOAT, OFF(y)}, - {"w", T_FLOAT, OFF(w)}, - {"h", T_FLOAT, OFF(h)}, - {"col1", T_INT, OFF(col1)}, - {"col2", T_INT, OFF(col2)}, - {"align", T_INT, OFF(align)}, - {"lcol", T_INT, OFF(lcol)}, - {"lsize", T_FLOAT, OFF(lsize)}, - /* "label" is treated specially! */ - {"lstyle", T_INT, OFF(lstyle)}, - {"pushed", T_INT, OFF(pushed), RO}, - {"focus", T_INT, OFF(focus), RO}, - {"belowmouse", T_INT, OFF(belowmouse),RO}, -/* {"frozen", T_INT, OFF(frozen), RO}, */ - {"active", T_INT, OFF(active)}, - {"input", T_INT, OFF(input)}, - {"visible", T_INT, OFF(visible), RO}, - {"radio", T_INT, OFF(radio)}, - {"automatic", T_INT, OFF(automatic)}, - {NULL} /* Sentinel */ -}; - -#undef OFF - -static PyObject * -generic_getattr(genericobject *g, char *name) -{ - PyObject *meth; - - /* XXX Ought to special-case name "__methods__" */ - if (g-> ob_methods) { - meth = Py_FindMethod(g->ob_methods, (PyObject *)g, name); - if (meth != NULL) return meth; - PyErr_Clear(); - } - - meth = Py_FindMethod(generic_methods, (PyObject *)g, name); - if (meth != NULL) - return meth; - PyErr_Clear(); - - /* "label" is an exception, getmember only works for char pointers, - not for char arrays */ - if (strcmp(name, "label") == 0) - return PyString_FromString(g->ob_generic->label); - - return PyMember_Get((char *)g->ob_generic, generic_memberlist, name); -} - -static int -generic_setattr(genericobject *g, char *name, PyObject *v) -{ - int ret; - - if (v == NULL) { - PyErr_SetString(PyExc_TypeError, - "can't delete forms object attributes"); - return -1; - } - - /* "label" is an exception: setmember doesn't set strings; - and FORMS wants you to call a function to set the label */ - if (strcmp(name, "label") == 0) { - if (!PyString_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "label attr must be string"); - return -1; - } - fl_set_object_label(g->ob_generic, PyString_AsString(v)); - return 0; - } - - ret = PyMember_Set((char *)g->ob_generic, generic_memberlist, name, v); - - /* Rather than calling all the various set_object_* functions, - we call fl_redraw_object here. This is sometimes redundant - but I doubt that's a big problem */ - if (ret == 0) - fl_redraw_object(g->ob_generic); - - return ret; -} - -static PyObject * -generic_repr(genericobject *g) -{ - char buf[100]; - PyOS_snprintf(buf, sizeof(buf), "<FORMS_object at %p, objclass=%d>", - g, g->ob_generic->objclass); - return PyString_FromString(buf); -} - -static PyTypeObject GenericObjecttype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "fl.FORMS_object", /*tp_name*/ - sizeof(genericobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)generic_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)generic_getattr, /*tp_getattr*/ - (setattrfunc)generic_setattr, /*tp_setattr*/ - 0, /*tp_compare*/ - (reprfunc)generic_repr, /*tp_repr*/ -}; - -static PyObject * -newgenericobject(FL_OBJECT *generic, PyMethodDef *methods) -{ - genericobject *g; - g = PyObject_New(genericobject, &GenericObjecttype); - if (g == NULL) - return NULL; - g-> ob_generic = generic; - g->ob_methods = methods; - g->ob_callback = NULL; - g->ob_callback_arg = NULL; - knowgeneric(g); - return (PyObject *)g; -} - -/**********************************************************************/ -/* Some common calling sequences */ - -/* void func (object, float) */ -static PyObject * -call_forms_INf (void (*func)(FL_OBJECT *, float), FL_OBJECT *obj, PyObject *args) -{ - float parameter; - - if (!PyArg_Parse(args, "f", ¶meter)) return NULL; - - (*func) (obj, parameter); - - Py_INCREF(Py_None); - return Py_None; -} - -/* void func (object, float) */ -static PyObject * -call_forms_INfINf (void (*func)(FL_OBJECT *, float, float), FL_OBJECT *obj, PyObject *args) -{ - float par1, par2; - - if (!PyArg_Parse(args, "(ff)", &par1, &par2)) return NULL; - - (*func) (obj, par1, par2); - - Py_INCREF(Py_None); - return Py_None; -} - -/* void func (object, int) */ -static PyObject * -call_forms_INi (void (*func)(FL_OBJECT *, int), FL_OBJECT *obj, PyObject *args) -{ - int parameter; - - if (!PyArg_Parse(args, "i", ¶meter)) return NULL; - - (*func) (obj, parameter); - - Py_INCREF(Py_None); - return Py_None; -} - -/* void func (object, char) */ -static PyObject * -call_forms_INc (void (*func)(FL_OBJECT *, int), FL_OBJECT *obj, PyObject *args) -{ - char *a; - - if (!PyArg_Parse(args, "s", &a)) return NULL; - - (*func) (obj, a[0]); - - Py_INCREF(Py_None); - return Py_None; -} - -/* void func (object, string) */ -static PyObject * -call_forms_INstr (void (*func)(FL_OBJECT *, char *), FL_OBJECT *obj, PyObject *args) -{ - char *a; - - if (!PyArg_Parse(args, "s", &a)) return NULL; - - (*func) (obj, a); - - Py_INCREF(Py_None); - return Py_None; -} - - -/* void func (object, int, string) */ -static PyObject * -call_forms_INiINstr (void (*func)(FL_OBJECT *, int, char *), FL_OBJECT *obj, PyObject *args) -{ - char *b; - int a; - - if (!PyArg_Parse(args, "(is)", &a, &b)) return NULL; - - (*func) (obj, a, b); - - Py_INCREF(Py_None); - return Py_None; -} - -#ifdef UNUSED -/* void func (object, int, int) */ -static PyObject * -call_forms_INiINi (void (*func)(FL_OBJECT *, int, int), FL_OBJECT *obj, PyObject *args) -{ - int par1, par2; - - if (!PyArg_Parse(args, "(ii)", &par1, &par2)) return NULL; - - (*func) (obj, par1, par2); - - Py_INCREF(Py_None); - return Py_None; -} -#endif - -/* int func (object) */ -static PyObject * -call_forms_Ri (int (*func)(FL_OBJECT *), FL_OBJECT *obj) -{ - int retval; - - retval = (*func) (obj); - - return PyInt_FromLong ((long) retval); -} - -/* char * func (object) */ -static PyObject * -call_forms_Rstr (char * (*func)(FL_OBJECT *), FL_OBJECT *obj) -{ - char *str; - - str = (*func) (obj); - - if (str == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString (str); -} - -/* int func (object) */ -static PyObject * -call_forms_Rf (float (*func)(FL_OBJECT *), FL_OBJECT *obj) -{ - float retval; - - retval = (*func) (obj); - - return PyFloat_FromDouble (retval); -} - -static PyObject * -call_forms_OUTfOUTf (void (*func)(FL_OBJECT *, float *, float *), FL_OBJECT *obj) -{ - float f1, f2; - - (*func) (obj, &f1, &f2); - - return Py_BuildValue("(ff)", f1, f2); -} - -#ifdef UNUSED -static PyObject * -call_forms_OUTf (void (*func)(FL_OBJECT *, float *), FL_OBJECT *obj) -{ - float f; - - (*func) (obj, &f); - - return PyFloat_FromDouble (f); -} -#endif - -/**********************************************************************/ -/* Class : browser */ - -static PyObject * -set_browser_topline(genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_browser_topline, g-> ob_generic, args); -} - -static PyObject * -clear_browser(genericobject *g) -{ - return generic_call (g, fl_clear_browser); -} - -static PyObject * -add_browser_line (genericobject *g, PyObject *args) -{ - return call_forms_INstr (fl_add_browser_line, g-> ob_generic, args); -} - -static PyObject * -addto_browser (genericobject *g, PyObject *args) -{ - return call_forms_INstr (fl_addto_browser, g-> ob_generic, args); -} - -static PyObject * -insert_browser_line (genericobject *g, PyObject *args) -{ - return call_forms_INiINstr (fl_insert_browser_line, - g-> ob_generic, args); -} - -static PyObject * -delete_browser_line (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_delete_browser_line, g-> ob_generic, args); -} - -static PyObject * -replace_browser_line (genericobject *g, PyObject *args) -{ - return call_forms_INiINstr (fl_replace_browser_line, - g-> ob_generic, args); -} - -static PyObject * -get_browser_line(genericobject *g, PyObject *args) -{ - int i; - char *str; - - if (!PyArg_Parse(args, "i", &i)) - return NULL; - - str = fl_get_browser_line (g->ob_generic, i); - - if (str == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString (str); -} - -static PyObject * -load_browser (genericobject *g, PyObject *args) -{ - /* XXX strictly speaking this is wrong since fl_load_browser - XXX returns int, not void */ - return call_forms_INstr (fl_load_browser, g-> ob_generic, args); -} - -static PyObject * -get_browser_maxline(genericobject *g) -{ - return call_forms_Ri (fl_get_browser_maxline, g-> ob_generic); -} - -static PyObject * -select_browser_line (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_select_browser_line, g-> ob_generic, args); -} - -static PyObject * -deselect_browser_line (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_deselect_browser_line, g-> ob_generic, args); -} - -static PyObject * -deselect_browser (genericobject *g) -{ - return generic_call (g, fl_deselect_browser); -} - -static PyObject * -isselected_browser_line (genericobject *g, PyObject *args) -{ - int i, j; - - if (!PyArg_Parse(args, "i", &i)) - return NULL; - - j = fl_isselected_browser_line (g->ob_generic, i); - - return PyInt_FromLong (j); -} - -static PyObject * -get_browser (genericobject *g) -{ - return call_forms_Ri (fl_get_browser, g-> ob_generic); -} - -static PyObject * -set_browser_fontsize (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_browser_fontsize, g-> ob_generic, args); -} - -static PyObject * -set_browser_fontstyle (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_browser_fontstyle, g-> ob_generic, args); -} - -static PyObject * -set_browser_specialkey (genericobject *g, PyObject *args) -{ - return call_forms_INc(fl_set_browser_specialkey, g-> ob_generic, args); -} - -static PyMethodDef browser_methods[] = { - {"set_browser_topline", (PyCFunction)set_browser_topline, - METH_OLDARGS}, - {"clear_browser", (PyCFunction)clear_browser, - METH_NOARGS}, - {"add_browser_line", (PyCFunction)add_browser_line, - METH_OLDARGS}, - {"addto_browser", (PyCFunction)addto_browser, - METH_OLDARGS}, - {"insert_browser_line", (PyCFunction)insert_browser_line, - METH_OLDARGS}, - {"delete_browser_line", (PyCFunction)delete_browser_line, - METH_OLDARGS}, - {"replace_browser_line", (PyCFunction)replace_browser_line, - METH_OLDARGS}, - {"get_browser_line", (PyCFunction)get_browser_line, - METH_OLDARGS}, - {"load_browser", (PyCFunction)load_browser, - METH_OLDARGS}, - {"get_browser_maxline", (PyCFunction)get_browser_maxline, - METH_NOARGS,} - {"select_browser_line", (PyCFunction)select_browser_line, - METH_OLDARGS}, - {"deselect_browser_line", (PyCFunction)deselect_browser_line, - METH_OLDARGS}, - {"deselect_browser", (PyCFunction)deselect_browser, - METH_NOARGS,} - {"isselected_browser_line", (PyCFunction)isselected_browser_line, - METH_OLDARGS}, - {"get_browser", (PyCFunction)get_browser, - METH_NOARGS,} - {"set_browser_fontsize", (PyCFunction)set_browser_fontsize, - METH_OLDARGS}, - {"set_browser_fontstyle", (PyCFunction)set_browser_fontstyle, - METH_OLDARGS}, - {"set_browser_specialkey", (PyCFunction)set_browser_specialkey, - METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -/* Class: button */ - -static PyObject * -set_button(genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_button, g-> ob_generic, args); -} - -static PyObject * -get_button(genericobject *g) -{ - return call_forms_Ri (fl_get_button, g-> ob_generic); -} - -static PyObject * -get_button_numb(genericobject *g) -{ - return call_forms_Ri (fl_get_button_numb, g-> ob_generic); -} - -static PyObject * -set_button_shortcut(genericobject *g, PyObject *args) -{ - return call_forms_INstr (fl_set_button_shortcut, g-> ob_generic, args); -} - -static PyMethodDef button_methods[] = { - {"set_button", (PyCFunction)set_button, METH_OLDARGS}, - {"get_button", (PyCFunction)get_button, METH_NOARGS}, - {"get_button_numb", (PyCFunction)get_button_numb, METH_NOARGS}, - {"set_button_shortcut", (PyCFunction)set_button_shortcut, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -/* Class: choice */ - -static PyObject * -set_choice(genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_choice, g-> ob_generic, args); -} - -static PyObject * -get_choice(genericobject *g) -{ - return call_forms_Ri (fl_get_choice, g-> ob_generic); -} - -static PyObject * -clear_choice (genericobject *g) -{ - return generic_call (g, fl_clear_choice); -} - -static PyObject * -addto_choice (genericobject *g, PyObject *args) -{ - return call_forms_INstr (fl_addto_choice, g-> ob_generic, args); -} - -static PyObject * -replace_choice (genericobject *g, PyObject *args) -{ - return call_forms_INiINstr (fl_replace_choice, g-> ob_generic, args); -} - -static PyObject * -delete_choice (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_delete_choice, g-> ob_generic, args); -} - -static PyObject * -get_choice_text (genericobject *g) -{ - return call_forms_Rstr (fl_get_choice_text, g-> ob_generic); -} - -static PyObject * -set_choice_fontsize (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_choice_fontsize, g-> ob_generic, args); -} - -static PyObject * -set_choice_fontstyle (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_choice_fontstyle, g-> ob_generic, args); -} - -static PyMethodDef choice_methods[] = { - {"set_choice", (PyCFunction)set_choice, METH_OLDARGS}, - {"get_choice", (PyCFunction)get_choice, METH_NOARGS}, - {"clear_choice", (PyCFunction)clear_choice, METH_NOARGS}, - {"addto_choice", (PyCFunction)addto_choice, METH_OLDARGS}, - {"replace_choice", (PyCFunction)replace_choice, METH_OLDARGS}, - {"delete_choice", (PyCFunction)delete_choice, METH_OLDARGS}, - {"get_choice_text", (PyCFunction)get_choice_text, METH_NOARGS}, - {"set_choice_fontsize", (PyCFunction)set_choice_fontsize, METH_OLDARGS}, - {"set_choice_fontstyle",(PyCFunction)set_choice_fontstyle, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -/* Class : Clock */ - -static PyObject * -get_clock(genericobject *g) -{ - int i0, i1, i2; - - fl_get_clock (g->ob_generic, &i0, &i1, &i2); - - return Py_BuildValue("(iii)", i0, i1, i2); -} - -static PyMethodDef clock_methods[] = { - {"get_clock", (PyCFunction)get_clock, METH_NOARGS}, - {NULL, NULL} /* sentinel */ -}; - -/* CLass : Counters */ - -static PyObject * -get_counter_value(genericobject *g) -{ - return call_forms_Rf (fl_get_counter_value, g-> ob_generic); -} - -static PyObject * -set_counter_value (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_counter_value, g-> ob_generic, args); -} - -static PyObject * -set_counter_precision (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_counter_precision, g-> ob_generic, args); -} - -static PyObject * -set_counter_bounds (genericobject *g, PyObject *args) -{ - return call_forms_INfINf (fl_set_counter_bounds, g-> ob_generic, args); -} - -static PyObject * -set_counter_step (genericobject *g, PyObject *args) -{ - return call_forms_INfINf (fl_set_counter_step, g-> ob_generic, args); -} - -static PyObject * -set_counter_return (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_counter_return, g-> ob_generic, args); -} - -static PyMethodDef counter_methods[] = { - {"set_counter_value", (PyCFunction)set_counter_value, - METH_OLDARGS}, - {"get_counter_value", (PyCFunction)get_counter_value, - METH_NOARGS}, - {"set_counter_bounds", (PyCFunction)set_counter_bounds, - METH_OLDARGS}, - {"set_counter_step", (PyCFunction)set_counter_step, - METH_OLDARGS}, - {"set_counter_precision", (PyCFunction)set_counter_precision, - METH_OLDARGS}, - {"set_counter_return", (PyCFunction)set_counter_return, - METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - - -/* Class: Dials */ - -static PyObject * -get_dial_value(genericobject *g) -{ - return call_forms_Rf (fl_get_dial_value, g-> ob_generic); -} - -static PyObject * -set_dial_value (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_dial_value, g-> ob_generic, args); -} - -static PyObject * -set_dial_bounds (genericobject *g, PyObject *args) -{ - return call_forms_INfINf (fl_set_dial_bounds, g-> ob_generic, args); -} - -static PyObject * -get_dial_bounds (genericobject *g) -{ - return call_forms_OUTfOUTf (fl_get_dial_bounds, g-> ob_generic); -} - -static PyObject * -set_dial_step (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_dial_step, g-> ob_generic, args); -} - -static PyMethodDef dial_methods[] = { - {"set_dial_value", (PyCFunction)set_dial_value, METH_OLDARGS}, - {"get_dial_value", (PyCFunction)get_dial_value, METH_NOARGS}, - {"set_dial_bounds", (PyCFunction)set_dial_bounds, METH_OLDARGS}, - {"get_dial_bounds", (PyCFunction)get_dial_bounds, METH_NOARGS}, - {"set_dial_step", (PyCFunction)set_dial_step, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -/* Class : Input */ - -static PyObject * -set_input (genericobject *g, PyObject *args) -{ - return call_forms_INstr (fl_set_input, g-> ob_generic, args); -} - -static PyObject * -get_input (genericobject *g) -{ - return call_forms_Rstr (fl_get_input, g-> ob_generic); -} - -static PyObject * -set_input_color (genericobject *g, PyObject *args) -{ - return call_forms_INfINf (fl_set_input_color, g-> ob_generic, args); -} - -static PyObject * -set_input_return (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_input_return, g-> ob_generic, args); -} - -static PyMethodDef input_methods[] = { - {"set_input", (PyCFunction)set_input, METH_OLDARGS}, - {"get_input", (PyCFunction)get_input, METH_NOARGS}, - {"set_input_color", (PyCFunction)set_input_color, METH_OLDARGS}, - {"set_input_return", (PyCFunction)set_input_return, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - - -/* Class : Menu */ - -static PyObject * -set_menu (genericobject *g, PyObject *args) -{ - return call_forms_INstr (fl_set_menu, g-> ob_generic, args); -} - -static PyObject * -get_menu (genericobject *g) -{ - /* XXX strictly speaking this is wrong since fl_get_menu - XXX returns long, not int */ - return call_forms_Ri (fl_get_menu, g-> ob_generic); -} - -static PyObject * -get_menu_text (genericobject *g) -{ - return call_forms_Rstr (fl_get_menu_text, g-> ob_generic); -} - -static PyObject * -addto_menu (genericobject *g, PyObject *args) -{ - return call_forms_INstr (fl_addto_menu, g-> ob_generic, args); -} - -static PyMethodDef menu_methods[] = { - {"set_menu", (PyCFunction)set_menu, METH_OLDARGS}, - {"get_menu", (PyCFunction)get_menu, METH_NOARGS}, - {"get_menu_text", (PyCFunction)get_menu_text, METH_NOARGS}, - {"addto_menu", (PyCFunction)addto_menu, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - - -/* Class: Sliders */ - -static PyObject * -get_slider_value(genericobject *g) -{ - return call_forms_Rf (fl_get_slider_value, g-> ob_generic); -} - -static PyObject * -set_slider_value (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_slider_value, g-> ob_generic, args); -} - -static PyObject * -set_slider_bounds (genericobject *g, PyObject *args) -{ - return call_forms_INfINf (fl_set_slider_bounds, g-> ob_generic, args); -} - -static PyObject * -get_slider_bounds (genericobject *g) -{ - return call_forms_OUTfOUTf(fl_get_slider_bounds, g-> ob_generic); -} - -static PyObject * -set_slider_return (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_slider_return, g-> ob_generic, args); -} - -static PyObject * -set_slider_size (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_slider_size, g-> ob_generic, args); -} - -static PyObject * -set_slider_precision (genericobject *g, PyObject *args) -{ - return call_forms_INi (fl_set_slider_precision, g-> ob_generic, args); -} - -static PyObject * -set_slider_step (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_slider_step, g-> ob_generic, args); -} - - -static PyMethodDef slider_methods[] = { - {"set_slider_value", (PyCFunction)set_slider_value, METH_OLDARGS}, - {"get_slider_value", (PyCFunction)get_slider_value, METH_NOARGS}, - {"set_slider_bounds", (PyCFunction)set_slider_bounds, METH_OLDARGS}, - {"get_slider_bounds", (PyCFunction)get_slider_bounds, METH_NOARGS}, - {"set_slider_return", (PyCFunction)set_slider_return, METH_OLDARGS}, - {"set_slider_size", (PyCFunction)set_slider_size, METH_OLDARGS}, - {"set_slider_precision",(PyCFunction)set_slider_precision, METH_OLDARGS}, - {"set_slider_step", (PyCFunction)set_slider_step, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -set_positioner_xvalue (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_positioner_xvalue, g-> ob_generic, args); -} - -static PyObject * -set_positioner_xbounds (genericobject *g, PyObject *args) -{ - return call_forms_INfINf (fl_set_positioner_xbounds, - g-> ob_generic, args); -} - -static PyObject * -set_positioner_yvalue (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_positioner_yvalue, g-> ob_generic, args); -} - -static PyObject * -set_positioner_ybounds (genericobject *g, PyObject *args) -{ - return call_forms_INfINf (fl_set_positioner_ybounds, - g-> ob_generic, args); -} - -static PyObject * -get_positioner_xvalue (genericobject *g) -{ - return call_forms_Rf (fl_get_positioner_xvalue, g-> ob_generic); -} - -static PyObject * -get_positioner_xbounds (genericobject *g) -{ - return call_forms_OUTfOUTf (fl_get_positioner_xbounds, g-> ob_generic); -} - -static PyObject * -get_positioner_yvalue (genericobject *g) -{ - return call_forms_Rf (fl_get_positioner_yvalue, g-> ob_generic); -} - -static PyObject * -get_positioner_ybounds (genericobject *g) -{ - return call_forms_OUTfOUTf (fl_get_positioner_ybounds, g-> ob_generic); -} - -static PyMethodDef positioner_methods[] = { - {"set_positioner_xvalue", (PyCFunction)set_positioner_xvalue, - METH_OLDARGS}, - {"set_positioner_yvalue", (PyCFunction)set_positioner_yvalue, - METH_OLDARGS}, - {"set_positioner_xbounds", (PyCFunction)set_positioner_xbounds, - METH_OLDARGS}, - {"set_positioner_ybounds", (PyCFunction)set_positioner_ybounds, - METH_OLDARGS}, - {"get_positioner_xvalue", (PyCFunction)get_positioner_xvalue, - METH_NOARGS}, - {"get_positioner_yvalue", (PyCFunction)get_positioner_yvalue, - METH_NOARGS}, - {"get_positioner_xbounds", (PyCFunction)get_positioner_xbounds, - METH_NOARGS}, - {"get_positioner_ybounds", (PyCFunction)get_positioner_ybounds, - METH_NOARGS}, - {NULL, NULL} /* sentinel */ -}; - -/* Class timer */ - -static PyObject * -set_timer (genericobject *g, PyObject *args) -{ - return call_forms_INf (fl_set_timer, g-> ob_generic, args); -} - -static PyObject * -get_timer (genericobject *g) -{ - return call_forms_Rf (fl_get_timer, g-> ob_generic); -} - -static PyMethodDef timer_methods[] = { - {"set_timer", (PyCFunction)set_timer, METH_OLDARGS}, - {"get_timer", (PyCFunction)get_timer, METH_NOARGS}, - {NULL, NULL} /* sentinel */ -}; - -/* Form objects */ - -typedef struct { - PyObject_HEAD - FL_FORM *ob_form; -} formobject; - -static PyTypeObject Formtype; - -#define is_formobject(v) ((v)->ob_type == &Formtype) - -static PyObject * -form_show_form(formobject *f, PyObject *args) -{ - int place, border; - char *name; - if (!PyArg_Parse(args, "(iis)", &place, &border, &name)) - return NULL; - fl_show_form(f->ob_form, place, border, name); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -form_call(void (*func)(FL_FORM *), FL_FORM *f) -{ - (*func)(f); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -form_call_INiINi(void (*func)(FL_FORM *, int, int), FL_FORM *f, PyObject *args) -{ - int a, b; - - if (!PyArg_Parse(args, "(ii)", &a, &b)) return NULL; - - (*func)(f, a, b); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -form_call_INfINf(void (*func)(FL_FORM *, float, float), FL_FORM *f, PyObject *args) -{ - float a, b; - - if (!PyArg_Parse(args, "(ff)", &a, &b)) return NULL; - - (*func)(f, a, b); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -form_hide_form(formobject *f) -{ - return form_call(fl_hide_form, f-> ob_form); -} - -static PyObject * -form_redraw_form(formobject *f) -{ - return form_call(fl_redraw_form, f-> ob_form); -} - -static PyObject * -form_set_form_position(formobject *f, PyObject *args) -{ - return form_call_INiINi(fl_set_form_position, f-> ob_form, args); -} - -static PyObject * -form_set_form_size(formobject *f, PyObject *args) -{ - return form_call_INiINi(fl_set_form_size, f-> ob_form, args); -} - -static PyObject * -form_scale_form(formobject *f, PyObject *args) -{ - return form_call_INfINf(fl_scale_form, f-> ob_form, args); -} - -static PyObject * -generic_add_object(formobject *f, PyObject *args, FL_OBJECT *(*func)(int, float, float, float, float, char*), PyMethodDef *internal_methods) -{ - int type; - float x, y, w, h; - char *name; - FL_OBJECT *obj; - - if (!PyArg_Parse(args,"(iffffs)", &type,&x,&y,&w,&h,&name)) - return NULL; - - fl_addto_form (f-> ob_form); - - obj = (*func) (type, x, y, w, h, name); - - fl_end_form(); - - if (obj == NULL) { - PyErr_NoMemory(); - return NULL; - } - - return newgenericobject (obj, internal_methods); -} - -static PyObject * -form_add_button(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_button, button_methods); -} - -static PyObject * -form_add_lightbutton(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_lightbutton, button_methods); -} - -static PyObject * -form_add_roundbutton(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_roundbutton, button_methods); -} - -static PyObject * -form_add_menu (formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_menu, menu_methods); -} - -static PyObject * -form_add_slider(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_slider, slider_methods); -} - -static PyObject * -form_add_valslider(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_valslider, slider_methods); -} - -static PyObject * -form_add_dial(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_dial, dial_methods); -} - -static PyObject * -form_add_counter(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_counter, counter_methods); -} - -static PyObject * -form_add_clock(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_clock, clock_methods); -} - -static PyObject * -form_add_box(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_box, - (PyMethodDef *)NULL); -} - -static PyObject * -form_add_choice(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_choice, choice_methods); -} - -static PyObject * -form_add_browser(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_browser, browser_methods); -} - -static PyObject * -form_add_positioner(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_positioner, - positioner_methods); -} - -static PyObject * -form_add_input(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_input, input_methods); -} - -static PyObject * -form_add_text(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_text, - (PyMethodDef *)NULL); -} - -static PyObject * -form_add_timer(formobject *f, PyObject *args) -{ - return generic_add_object(f, args, fl_add_timer, timer_methods); -} - -static PyObject * -form_freeze_form(formobject *f) -{ - return form_call(fl_freeze_form, f-> ob_form); -} - -static PyObject * -form_unfreeze_form(formobject *f) -{ - return form_call(fl_unfreeze_form, f-> ob_form); -} - -static PyObject * -form_activate_form(formobject *f) -{ - return form_call(fl_activate_form, f-> ob_form); -} - -static PyObject * -form_deactivate_form(formobject *f) -{ - return form_call(fl_deactivate_form, f-> ob_form); -} - -static PyObject * -form_bgn_group(formobject *f, PyObject *args) -{ - FL_OBJECT *obj; - - fl_addto_form(f-> ob_form); - obj = fl_bgn_group(); - fl_end_form(); - - if (obj == NULL) { - PyErr_NoMemory(); - return NULL; - } - - return newgenericobject (obj, (PyMethodDef *) NULL); -} - -static PyObject * -form_end_group(formobject *f, PyObject *args) -{ - fl_addto_form(f-> ob_form); - fl_end_group(); - fl_end_form(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_find_first_or_last(FL_OBJECT *(*func)(FL_FORM *, int, float, float), formobject *f, PyObject *args) -{ - int type; - float mx, my; - FL_OBJECT *generic; - genericobject *g; - - if (!PyArg_Parse(args, "(iff)", &type, &mx, &my)) return NULL; - - generic = (*func) (f-> ob_form, type, mx, my); - - if (generic == NULL) - { - Py_INCREF(Py_None); - return Py_None; - } - - g = findgeneric(generic); - if (g == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "forms_find_{first|last} returns unknown object"); - return NULL; - } - Py_INCREF(g); - return (PyObject *) g; -} - -static PyObject * -form_find_first(formobject *f, PyObject *args) -{ - return forms_find_first_or_last(fl_find_first, f, args); -} - -static PyObject * -form_find_last(formobject *f, PyObject *args) -{ - return forms_find_first_or_last(fl_find_last, f, args); -} - -static PyObject * -form_set_object_focus(formobject *f, PyObject *args) -{ - genericobject *g; - if (args == NULL || !is_genericobject(args)) { - PyErr_BadArgument(); - return NULL; - } - g = (genericobject *)args; - fl_set_object_focus(f->ob_form, g->ob_generic); - Py_INCREF(Py_None); - return Py_None; -} - -static PyMethodDef form_methods[] = { -/* adm */ - {"show_form", (PyCFunction)form_show_form, METH_OLDARGS}, - {"hide_form", (PyCFunction)form_hide_form, METH_NOARGS}, - {"redraw_form", (PyCFunction)form_redraw_form, METH_NOARGS}, - {"set_form_position", (PyCFunction)form_set_form_position, METH_OLDARGS}, - {"set_form_size", (PyCFunction)form_set_form_size, METH_OLDARGS}, - {"scale_form", (PyCFunction)form_scale_form, METH_OLDARGS}, - {"freeze_form", (PyCFunction)form_freeze_form, METH_NOARGS}, - {"unfreeze_form", (PyCFunction)form_unfreeze_form, METH_NOARGS}, - {"activate_form", (PyCFunction)form_activate_form, METH_NOARGS}, - {"deactivate_form", (PyCFunction)form_deactivate_form, METH_NOARGS}, - {"bgn_group", (PyCFunction)form_bgn_group, METH_OLDARGS}, - {"end_group", (PyCFunction)form_end_group, METH_OLDARGS}, - {"find_first", (PyCFunction)form_find_first, METH_OLDARGS}, - {"find_last", (PyCFunction)form_find_last, METH_OLDARGS}, - {"set_object_focus", (PyCFunction)form_set_object_focus, METH_OLDARGS}, - -/* basic objects */ - {"add_button", (PyCFunction)form_add_button, METH_OLDARGS}, -/* {"add_bitmap", (method)form_add_bitmap, METH_OLDARGS}, */ - {"add_lightbutton", (PyCFunction)form_add_lightbutton, METH_OLDARGS}, - {"add_roundbutton", (PyCFunction)form_add_roundbutton, METH_OLDARGS}, - {"add_menu", (PyCFunction)form_add_menu, METH_OLDARGS}, - {"add_slider", (PyCFunction)form_add_slider, METH_OLDARGS}, - {"add_positioner", (PyCFunction)form_add_positioner, METH_OLDARGS}, - {"add_valslider", (PyCFunction)form_add_valslider, METH_OLDARGS}, - {"add_dial", (PyCFunction)form_add_dial, METH_OLDARGS}, - {"add_counter", (PyCFunction)form_add_counter, METH_OLDARGS}, - {"add_box", (PyCFunction)form_add_box, METH_OLDARGS}, - {"add_clock", (PyCFunction)form_add_clock, METH_OLDARGS}, - {"add_choice", (PyCFunction)form_add_choice, METH_OLDARGS}, - {"add_browser", (PyCFunction)form_add_browser, METH_OLDARGS}, - {"add_input", (PyCFunction)form_add_input, METH_OLDARGS}, - {"add_timer", (PyCFunction)form_add_timer, METH_OLDARGS}, - {"add_text", (PyCFunction)form_add_text, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -static void -form_dealloc(formobject *f) -{ - releaseobjects(f->ob_form); - if (f->ob_form->visible) - fl_hide_form(f->ob_form); - fl_free_form(f->ob_form); - PyObject_Del(f); -} - -#define OFF(x) offsetof(FL_FORM, x) - -static struct memberlist form_memberlist[] = { - {"window", T_LONG, OFF(window), RO}, - {"w", T_FLOAT, OFF(w)}, - {"h", T_FLOAT, OFF(h)}, - {"x", T_FLOAT, OFF(x), RO}, - {"y", T_FLOAT, OFF(y), RO}, - {"deactivated", T_INT, OFF(deactivated)}, - {"visible", T_INT, OFF(visible), RO}, - {"frozen", T_INT, OFF(frozen), RO}, - {"doublebuf", T_INT, OFF(doublebuf)}, - {NULL} /* Sentinel */ -}; - -#undef OFF - -static PyObject * -form_getattr(formobject *f, char *name) -{ - PyObject *meth; - - meth = Py_FindMethod(form_methods, (PyObject *)f, name); - if (meth != NULL) - return meth; - PyErr_Clear(); - return PyMember_Get((char *)f->ob_form, form_memberlist, name); -} - -static int -form_setattr(formobject *f, char *name, PyObject *v) -{ - if (v == NULL) { - PyErr_SetString(PyExc_TypeError, - "can't delete form attributes"); - return -1; - } - - return PyMember_Set((char *)f->ob_form, form_memberlist, name, v); -} - -static PyObject * -form_repr(formobject *f) -{ - char buf[100]; - PyOS_snprintf(buf, sizeof(buf), "<FORMS_form at %p, window=%ld>", - f, f->ob_form->window); - return PyString_FromString(buf); -} - -static PyTypeObject Formtype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "fl.FORMS_form", /*tp_name*/ - sizeof(formobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)form_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)form_getattr, /*tp_getattr*/ - (setattrfunc)form_setattr, /*tp_setattr*/ - 0, /*tp_compare*/ - (reprfunc)form_repr, /*tp_repr*/ -}; - -static PyObject * -newformobject(FL_FORM *form) -{ - formobject *f; - f = PyObject_New(formobject, &Formtype); - if (f == NULL) - return NULL; - f->ob_form = form; - return (PyObject *)f; -} - - -/* The "fl" module */ - -static PyObject * -forms_make_form(PyObject *dummy, PyObject *args) -{ - int type; - float w, h; - FL_FORM *form; - if (!PyArg_Parse(args, "(iff)", &type, &w, &h)) - return NULL; - form = fl_bgn_form(type, w, h); - if (form == NULL) { - /* XXX Actually, cannot happen! */ - PyErr_NoMemory(); - return NULL; - } - fl_end_form(); - return newformobject(form); -} - -static PyObject * -forms_activate_all_forms(PyObject *f, PyObject *args) -{ - fl_activate_all_forms(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_deactivate_all_forms(PyObject *f, PyObject *args) -{ - fl_deactivate_all_forms(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject *my_event_callback = NULL; - -static PyObject * -forms_set_event_call_back(PyObject *dummy, PyObject *args) -{ - if (args == Py_None) - args = NULL; - my_event_callback = args; - Py_XINCREF(args); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_do_or_check_forms(PyObject *dummy, FL_OBJECT *(*func)(void)) -{ - FL_OBJECT *generic; - genericobject *g; - PyObject *arg, *res; - - for (;;) { - Py_BEGIN_ALLOW_THREADS - generic = (*func)(); - Py_END_ALLOW_THREADS - if (generic == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - if (generic == FL_EVENT) { - int dev; - short val; - if (my_event_callback == NULL) - return PyInt_FromLong(-1L); - dev = fl_qread(&val); - arg = Py_BuildValue("(ih)", dev, val); - if (arg == NULL) - return NULL; - res = PyEval_CallObject(my_event_callback, arg); - Py_XDECREF(res); - Py_DECREF(arg); - if (res == NULL) - return NULL; /* Callback raised exception */ - continue; - } - g = findgeneric(generic); - if (g == NULL) { - /* Object not known to us (some dialogs cause this) */ - continue; /* Ignore it */ - } - if (g->ob_callback == NULL) { - Py_INCREF(g); - return ((PyObject *) g); - } - arg = PyTuple_Pack(2, (PyObject *)g, g->ob_callback_arg); - if (arg == NULL) - return NULL; - res = PyEval_CallObject(g->ob_callback, arg); - Py_XDECREF(res); - Py_DECREF(arg); - if (res == NULL) - return NULL; /* Callback raised exception */ - } -} - -static PyObject * -forms_do_forms(PyObject *dummy) -{ - return forms_do_or_check_forms(dummy, fl_do_forms); -} - -static PyObject * -forms_check_forms(PyObject *dummy) -{ - return forms_do_or_check_forms(dummy, fl_check_forms); -} - -static PyObject * -forms_do_only_forms(PyObject *dummy) -{ - return forms_do_or_check_forms(dummy, fl_do_only_forms); -} - -static PyObject * -forms_check_only_forms(PyObject *dummy) -{ - return forms_do_or_check_forms(dummy, fl_check_only_forms); -} - -#ifdef UNUSED -static PyObject * -fl_call(void (*func)(void)) -{ - (*func)(); - Py_INCREF(Py_None); - return Py_None; -} -#endif - -static PyObject * -forms_set_graphics_mode(PyObject *dummy, PyObject *args) -{ - int rgbmode, doublebuf; - - if (!PyArg_Parse(args, "(ii)", &rgbmode, &doublebuf)) - return NULL; - fl_set_graphics_mode(rgbmode,doublebuf); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_get_rgbmode(PyObject *dummy, PyObject *args) -{ - extern int fl_rgbmode; - - if (args != NULL) { - PyErr_BadArgument(); - return NULL; - } - return PyInt_FromLong((long)fl_rgbmode); -} - -static PyObject * -forms_show_errors(PyObject *dummy, PyObject *args) -{ - int show; - if (!PyArg_Parse(args, "i", &show)) - return NULL; - fl_show_errors(show); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_set_font_name(PyObject *dummy, PyObject *args) -{ - int numb; - char *name; - if (!PyArg_Parse(args, "(is)", &numb, &name)) - return NULL; - fl_set_font_name(numb, name); - Py_INCREF(Py_None); - return Py_None; -} - - -static PyObject * -forms_qdevice(PyObject *self, PyObject *args) -{ - short arg1; - if (!PyArg_Parse(args, "h", &arg1)) - return NULL; - fl_qdevice(arg1); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_unqdevice(PyObject *self, PyObject *args) -{ - short arg1; - if (!PyArg_Parse(args, "h", &arg1)) - return NULL; - fl_unqdevice(arg1); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_isqueued(PyObject *self, PyObject *args) -{ - long retval; - short arg1; - if (!PyArg_Parse(args, "h", &arg1)) - return NULL; - retval = fl_isqueued(arg1); - - return PyInt_FromLong(retval); -} - -static PyObject * -forms_qtest(PyObject *self, PyObject *args) -{ - long retval; - retval = fl_qtest(); - return PyInt_FromLong(retval); -} - - -static PyObject * -forms_qread(PyObject *self, PyObject *args) -{ - int dev; - short val; - Py_BEGIN_ALLOW_THREADS - dev = fl_qread(&val); - Py_END_ALLOW_THREADS - return Py_BuildValue("(ih)", dev, val); -} - -static PyObject * -forms_qreset(PyObject *self) -{ - fl_qreset(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_qenter(PyObject *self, PyObject *args) -{ - short arg1, arg2; - if (!PyArg_Parse(args, "(hh)", &arg1, &arg2)) - return NULL; - fl_qenter(arg1, arg2); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_color(PyObject *self, PyObject *args) -{ - int arg; - - if (!PyArg_Parse(args, "i", &arg)) return NULL; - - fl_color((short) arg); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_mapcolor(PyObject *self, PyObject *args) -{ - int arg0, arg1, arg2, arg3; - - if (!PyArg_Parse(args, "(iiii)", &arg0, &arg1, &arg2, &arg3)) - return NULL; - - fl_mapcolor(arg0, (short) arg1, (short) arg2, (short) arg3); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_getmcolor(PyObject *self, PyObject *args) -{ - int arg; - short r, g, b; - - if (!PyArg_Parse(args, "i", &arg)) return NULL; - - fl_getmcolor(arg, &r, &g, &b); - - return Py_BuildValue("(hhh)", r, g, b); -} - -static PyObject * -forms_get_mouse(PyObject *self) -{ - float x, y; - - fl_get_mouse(&x, &y); - - return Py_BuildValue("(ff)", x, y); -} - -static PyObject * -forms_tie(PyObject *self, PyObject *args) -{ - short arg1, arg2, arg3; - if (!PyArg_Parse(args, "(hhh)", &arg1, &arg2, &arg3)) - return NULL; - fl_tie(arg1, arg2, arg3); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_show_message(PyObject *f, PyObject *args) -{ - char *a, *b, *c; - - if (!PyArg_Parse(args, "(sss)", &a, &b, &c)) return NULL; - - Py_BEGIN_ALLOW_THREADS - fl_show_message(a, b, c); - Py_END_ALLOW_THREADS - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -forms_show_choice(PyObject *f, PyObject *args) -{ - char *m1, *m2, *m3, *b1, *b2, *b3; - int nb; - char *format; - long rv; - - if (args == NULL || !PyTuple_Check(args)) { - PyErr_BadArgument(); - return NULL; - } - nb = PyTuple_Size(args) - 3; - if (nb <= 0) { - PyErr_SetString(PyExc_TypeError, - "need at least one button label"); - return NULL; - } - if (PyInt_Check(PyTuple_GetItem(args, 3))) { - PyErr_SetString(PyExc_TypeError, - "'number-of-buttons' argument not needed"); - return NULL; - } - switch (nb) { - case 1: format = "(ssss)"; break; - case 2: format = "(sssss)"; break; - case 3: format = "(ssssss)"; break; - default: - PyErr_SetString(PyExc_TypeError, "too many button labels"); - return NULL; - } - - if (!PyArg_Parse(args, format, &m1, &m2, &m3, &b1, &b2, &b3)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - rv = fl_show_choice(m1, m2, m3, nb, b1, b2, b3); - Py_END_ALLOW_THREADS - return PyInt_FromLong(rv); -} - -static PyObject * -forms_show_question(PyObject *f, PyObject *args) -{ - int ret; - char *a, *b, *c; - - if (!PyArg_Parse(args, "(sss)", &a, &b, &c)) return NULL; - - Py_BEGIN_ALLOW_THREADS - ret = fl_show_question(a, b, c); - Py_END_ALLOW_THREADS - - return PyInt_FromLong((long) ret); -} - -static PyObject * -forms_show_input(PyObject *f, PyObject *args) -{ - char *str; - char *a, *b; - - if (!PyArg_Parse(args, "(ss)", &a, &b)) return NULL; - - Py_BEGIN_ALLOW_THREADS - str = fl_show_input(a, b); - Py_END_ALLOW_THREADS - - if (str == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString(str); -} - -static PyObject * -forms_file_selector(PyObject *f, PyObject *args) -{ - char *str; - char *a, *b, *c, *d; - - if (!PyArg_Parse(args, "(ssss)", &a, &b, &c, &d)) return NULL; - - Py_BEGIN_ALLOW_THREADS - str = fl_show_file_selector(a, b, c, d); - Py_END_ALLOW_THREADS - - if (str == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString(str); -} - - -static PyObject * -forms_file_selector_func(PyObject *args, char *(*func)(void)) -{ - char *str; - - str = (*func) (); - - if (str == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString(str); -} - -static PyObject * -forms_get_directory(PyObject *f, PyObject *args) -{ - return forms_file_selector_func(args, fl_get_directory); -} - -static PyObject * -forms_get_pattern(PyObject *f, PyObject *args) -{ - return forms_file_selector_func(args, fl_get_pattern); -} - -static PyObject * -forms_get_filename(PyObject *f, PyObject *args) -{ - return forms_file_selector_func(args, fl_get_filename); -} - -static PyMethodDef forms_methods[] = { -/* adm */ - {"make_form", forms_make_form, METH_OLDARGS}, - {"activate_all_forms", forms_activate_all_forms, METH_OLDARGS}, - {"deactivate_all_forms",forms_deactivate_all_forms, METH_OLDARGS}, -/* gl support wrappers */ - {"qdevice", forms_qdevice, METH_OLDARGS}, - {"unqdevice", forms_unqdevice, METH_OLDARGS}, - {"isqueued", forms_isqueued, METH_OLDARGS}, - {"qtest", forms_qtest, METH_OLDARGS}, - {"qread", forms_qread, METH_OLDARGS}, -/* {"blkqread", forms_blkqread, METH_OLDARGS}, */ - {"qreset", forms_qreset, METH_NOARGS}, - {"qenter", forms_qenter, METH_OLDARGS}, - {"get_mouse", forms_get_mouse, METH_NOARGS}, - {"tie", forms_tie, METH_OLDARGS}, -/* {"new_events", forms_new_events, METH_OLDARGS}, */ - {"color", forms_color, METH_OLDARGS}, - {"mapcolor", forms_mapcolor, METH_OLDARGS}, - {"getmcolor", forms_getmcolor, METH_OLDARGS}, -/* interaction */ - {"do_forms", forms_do_forms, METH_NOARGS}, - {"do_only_forms", forms_do_only_forms, METH_NOARGS}, - {"check_forms", forms_check_forms, METH_NOARGS}, - {"check_only_forms", forms_check_only_forms, METH_NOARGS}, - {"set_event_call_back", forms_set_event_call_back, METH_OLDARGS}, -/* goodies */ - {"show_message", forms_show_message, METH_OLDARGS}, - {"show_question", forms_show_question, METH_OLDARGS}, - {"show_choice", forms_show_choice, METH_OLDARGS}, - {"show_input", forms_show_input, METH_OLDARGS}, - {"show_file_selector", forms_file_selector, METH_OLDARGS}, - {"file_selector", forms_file_selector, METH_OLDARGS}, /* BW compat */ - {"get_directory", forms_get_directory, METH_OLDARGS}, - {"get_pattern", forms_get_pattern, METH_OLDARGS}, - {"get_filename", forms_get_filename, METH_OLDARGS}, - {"set_graphics_mode", forms_set_graphics_mode, METH_OLDARGS}, - {"get_rgbmode", forms_get_rgbmode, METH_OLDARGS}, - {"show_errors", forms_show_errors, METH_OLDARGS}, - {"set_font_name", forms_set_font_name, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -PyMODINIT_FUNC -initfl(void) -{ - Py_InitModule("fl", forms_methods); - if (m == NULL) - return; - foreground(); - fl_init(); -} - - - diff --git a/Modules/fmmodule.c b/Modules/fmmodule.c deleted file mode 100644 index 1f7edb6..0000000 --- a/Modules/fmmodule.c +++ /dev/null @@ -1,264 +0,0 @@ - -/* Font Manager module */ - -#include "Python.h" - -#include <gl.h> -#include <device.h> -#include <fmclient.h> - - -/* Font Handle object implementation */ - -typedef struct { - PyObject_HEAD - fmfonthandle fh_fh; -} fhobject; - -static PyTypeObject Fhtype; - -#define is_fhobject(v) ((v)->ob_type == &Fhtype) - -static PyObject * -newfhobject(fmfonthandle fh) -{ - fhobject *fhp; - if (fh == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "error creating new font handle"); - return NULL; - } - fhp = PyObject_New(fhobject, &Fhtype); - if (fhp == NULL) - return NULL; - fhp->fh_fh = fh; - return (PyObject *)fhp; -} - -/* Font Handle methods */ - -static PyObject * -fh_scalefont(fhobject *self, PyObject *args) -{ - double size; - if (!PyArg_ParseTuple(args, "d", &size)) - return NULL; - return newfhobject(fmscalefont(self->fh_fh, size)); -} - -/* XXX fmmakefont */ - -static PyObject * -fh_setfont(fhobject *self) -{ - fmsetfont(self->fh_fh); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -fh_getfontname(fhobject *self) -{ - char fontname[256]; - int len; - len = fmgetfontname(self->fh_fh, sizeof fontname, fontname); - if (len < 0) { - PyErr_SetString(PyExc_RuntimeError, "error in fmgetfontname"); - return NULL; - } - return PyString_FromStringAndSize(fontname, len); -} - -static PyObject * -fh_getcomment(fhobject *self) -{ - char comment[256]; - int len; - len = fmgetcomment(self->fh_fh, sizeof comment, comment); - if (len < 0) { - PyErr_SetString(PyExc_RuntimeError, "error in fmgetcomment"); - return NULL; - } - return PyString_FromStringAndSize(comment, len); -} - -static PyObject * -fh_getfontinfo(fhobject *self) -{ - fmfontinfo info; - if (fmgetfontinfo(self->fh_fh, &info) < 0) { - PyErr_SetString(PyExc_RuntimeError, "error in fmgetfontinfo"); - return NULL; - } - return Py_BuildValue("(llllllll)", - info.printermatched, - info.fixed_width, - info.xorig, - info.yorig, - info.xsize, - info.ysize, - info.height, - info.nglyphs); -} - -#if 0 -static PyObject * -fh_getwholemetrics(fhobject *self, PyObject *args) -{ -} -#endif - -static PyObject * -fh_getstrwidth(fhobject *self, PyObject *args) -{ - char *str; - if (!PyArg_ParseTuple(args, "s", &str)) - return NULL; - return PyInt_FromLong(fmgetstrwidth(self->fh_fh, str)); -} - -static PyMethodDef fh_methods[] = { - {"scalefont", (PyCFunction)fh_scalefont, METH_VARARGS}, - {"setfont", (PyCFunction)fh_setfont, METH_NOARGS}, - {"getfontname", (PyCFunction)fh_getfontname, METH_NOARGS}, - {"getcomment", (PyCFunction)fh_getcomment, METH_NOARGS}, - {"getfontinfo", (PyCFunction)fh_getfontinfo, METH_NOARGS}, -#if 0 - {"getwholemetrics", (PyCFunction)fh_getwholemetrics, METH_VARARGS}, -#endif - {"getstrwidth", (PyCFunction)fh_getstrwidth, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -fh_getattr(fhobject *fhp, char *name) -{ - return Py_FindMethod(fh_methods, (PyObject *)fhp, name); -} - -static void -fh_dealloc(fhobject *fhp) -{ - fmfreefont(fhp->fh_fh); - PyObject_Del(fhp); -} - -static PyTypeObject Fhtype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "fm.font handle", /*tp_name*/ - sizeof(fhobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)fh_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)fh_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ -}; - - -/* Font Manager functions */ - -static PyObject * -fm_init(PyObject *self) -{ - fminit(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -fm_findfont(PyObject *self, PyObject *args) -{ - char *str; - if (!PyArg_ParseTuple(args, "s", &str)) - return NULL; - return newfhobject(fmfindfont(str)); -} - -static PyObject * -fm_prstr(PyObject *self, PyObject *args) -{ - char *str; - if (!PyArg_ParseTuple(args, "s", &str)) - return NULL; - fmprstr(str); - Py_INCREF(Py_None); - return Py_None; -} - -/* XXX This uses a global variable as temporary! Not re-entrant! */ - -static PyObject *fontlist; - -static void -clientproc(char *fontname) -{ - int err; - PyObject *v; - if (fontlist == NULL) - return; - v = PyString_FromString(fontname); - if (v == NULL) - err = -1; - else { - err = PyList_Append(fontlist, v); - Py_DECREF(v); - } - if (err != 0) { - Py_DECREF(fontlist); - fontlist = NULL; - } -} - -static PyObject * -fm_enumerate(PyObject *self) -{ - PyObject *res; - fontlist = PyList_New(0); - if (fontlist == NULL) - return NULL; - fmenumerate(clientproc); - res = fontlist; - fontlist = NULL; - return res; -} - -static PyObject * -fm_setpath(PyObject *self, PyObject *args) -{ - char *str; - if (!PyArg_ParseTuple(args, "s", &str)) - return NULL; - fmsetpath(str); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -fm_fontpath(PyObject *self) -{ - return PyString_FromString(fmfontpath()); -} - -static PyMethodDef fm_methods[] = { - {"init", fm_init, METH_NOARGS}, - {"findfont", fm_findfont, METH_VARARGS}, - {"enumerate", fm_enumerate, METH_NOARGS}, - {"prstr", fm_prstr, METH_VARARGS}, - {"setpath", fm_setpath, METH_VARARGS}, - {"fontpath", fm_fontpath, METH_NOARGS}, - {NULL, NULL} /* sentinel */ -}; - - -void -initfm(void) -{ - Py_InitModule("fm", fm_methods); - if (m == NULL) - return; - fminit(); -} diff --git a/Modules/glmodule.c b/Modules/glmodule.c deleted file mode 100644 index 6590704..0000000 --- a/Modules/glmodule.c +++ /dev/null @@ -1,7628 +0,0 @@ - -/* -Input used to generate the Python module "glmodule.c". -The stub generator is a Python script called "cgen.py". - -Each definition must be contained on one line: - -<returntype> <name> <type> <arg> <type> <arg> - -<returntype> can be: void, short, long (XXX maybe others?) - -<type> can be: char, string, short, float, long, or double - string indicates a null terminated string; - if <type> is char and <arg> begins with a *, the * is stripped - and <type> is changed into string - -<arg> has the form <mode> or <mode>[<subscript>] - where <mode> can be - s: arg is sent - r: arg is received (arg is a pointer) - and <subscript> can be (N and I are numbers): - N - argI - retval - N*argI - N*I - N*retval - In the case where the subscript consists of two parts - separated by *, the first part is the width of the matrix, and - the second part is the length of the matrix. This order is - opposite from the order used in C to declare a two-dimensional - matrix. -*/ - -/* - * An attempt has been made to make this module switch threads on qread - * calls. It is far from safe, though. - */ - -#include <gl.h> -#include <device.h> - -#ifdef __sgi -extern int devport(); -extern int textwritemask(); -extern int pagewritemask(); -extern int gewrite(); -extern int gettp(); -#endif - -#include "Python.h" -#include "cgensupport.h" - -/* -Some stubs are too complicated for the stub generator. -We can include manually written versions of them here. -A line starting with '%' gives the name of the function so the stub -generator can include it in the table of functions. -*/ - - -static PyObject * -gl_qread(PyObject *self, PyObject *args) -{ - long retval; - short arg1 ; - Py_BEGIN_ALLOW_THREADS - retval = qread( & arg1 ); - Py_END_ALLOW_THREADS - { PyObject *v = PyTuple_New( 2 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewlongobject(retval)); - PyTuple_SetItem(v, 1, mknewshortobject(arg1)); - return v; - } -} - - -/* -varray -- an array of v.. calls. -The argument is an array (maybe list or tuple) of points. -Each point must be a tuple or list of coordinates (x, y, z). -The points may be 2- or 3-dimensional but must all have the -same dimension. Float and int values may be mixed however. -The points are always converted to 3D double precision points -by assuming z=0.0 if necessary (as indicated in the man page), -and for each point v3d() is called. -*/ - - -static PyObject * -gl_varray(PyObject *self, PyObject *args) -{ - PyObject *v, *w=NULL; - int i, n, width; - double vec[3]; - PyObject * (*getitem)(PyObject *, int); - - if (!PyArg_GetObject(args, 1, 0, &v)) - return NULL; - - if (PyList_Check(v)) { - n = PyList_Size(v); - getitem = PyList_GetItem; - } - else if (PyTuple_Check(v)) { - n = PyTuple_Size(v); - getitem = PyTuple_GetItem; - } - else { - PyErr_BadArgument(); - return NULL; - } - - if (n == 0) { - Py_INCREF(Py_None); - return Py_None; - } - if (n > 0) - w = (*getitem)(v, 0); - - width = 0; - if (w == NULL) { - } - else if (PyList_Check(w)) { - width = PyList_Size(w); - } - else if (PyTuple_Check(w)) { - width = PyTuple_Size(w); - } - - switch (width) { - case 2: - vec[2] = 0.0; - /* Fall through */ - case 3: - break; - default: - PyErr_BadArgument(); - return NULL; - } - - for (i = 0; i < n; i++) { - w = (*getitem)(v, i); - if (!PyArg_GetDoubleArray(w, 1, 0, width, vec)) - return NULL; - v3d(vec); - } - - Py_INCREF(Py_None); - return Py_None; -} - -/* -vnarray, nvarray -- an array of n3f and v3f calls. -The argument is an array (list or tuple) of pairs of points and normals. -Each pair is a tuple (NOT a list) of a point and a normal for that point. -Each point or normal must be a tuple (NOT a list) of coordinates (x, y, z). -Three coordinates must be given. Float and int values may be mixed. -For each pair, n3f() is called for the normal, and then v3f() is called -for the vector. - -vnarray and nvarray differ only in the order of the vector and normal in -the pair: vnarray expects (v, n) while nvarray expects (n, v). -*/ - -static PyObject *gen_nvarray(); /* Forward */ - - -static PyObject * -gl_nvarray(PyObject *self, PyObject *args) -{ - return gen_nvarray(args, 0); -} - - -static PyObject * -gl_vnarray(PyObject *self, PyObject *args) -{ - return gen_nvarray(args, 1); -} - -/* Generic, internal version of {nv,nv}array: inorm indicates the - argument order, 0: normal first, 1: vector first. */ - -static PyObject * -gen_nvarray(PyObject *args, int inorm) -{ - PyObject *v, *w, *wnorm, *wvec; - int i, n; - float norm[3], vec[3]; - PyObject * (*getitem)(PyObject *, int); - - if (!PyArg_GetObject(args, 1, 0, &v)) - return NULL; - - if (PyList_Check(v)) { - n = PyList_Size(v); - getitem = PyList_GetItem; - } - else if (PyTuple_Check(v)) { - n = PyTuple_Size(v); - getitem = PyTuple_GetItem; - } - else { - PyErr_BadArgument(); - return NULL; - } - - for (i = 0; i < n; i++) { - w = (*getitem)(v, i); - if (!PyTuple_Check(w) || PyTuple_Size(w) != 2) { - PyErr_BadArgument(); - return NULL; - } - wnorm = PyTuple_GetItem(w, inorm); - wvec = PyTuple_GetItem(w, 1 - inorm); - if (!PyArg_GetFloatArray(wnorm, 1, 0, 3, norm) || - !PyArg_GetFloatArray(wvec, 1, 0, 3, vec)) - return NULL; - n3f(norm); - v3f(vec); - } - - Py_INCREF(Py_None); - return Py_None; -} - -/* nurbssurface(s_knots[], t_knots[], ctl[][], s_order, t_order, type). - The dimensions of ctl[] are computed as follows: - [len(s_knots) - s_order], [len(t_knots) - t_order] -*/ - - -static PyObject * -gl_nurbssurface(PyObject *self, PyObject *args) -{ - long arg1 ; - double * arg2 ; - long arg3 ; - double * arg4 ; - double *arg5 ; - long arg6 ; - long arg7 ; - long arg8 ; - long ncoords; - long s_byte_stride, t_byte_stride; - long s_nctl, t_nctl; - long s, t; - PyObject *v, *w, *pt; - double *pnext; - if (!PyArg_GetLongArraySize(args, 6, 0, &arg1)) - return NULL; - if ((arg2 = PyMem_NEW(double, arg1 )) == NULL) { - return PyErr_NoMemory(); - } - if (!PyArg_GetDoubleArray(args, 6, 0, arg1 , arg2)) - return NULL; - if (!PyArg_GetLongArraySize(args, 6, 1, &arg3)) - return NULL; - if ((arg4 = PyMem_NEW(double, arg3 )) == NULL) { - return PyErr_NoMemory(); - } - if (!PyArg_GetDoubleArray(args, 6, 1, arg3 , arg4)) - return NULL; - if (!PyArg_GetLong(args, 6, 3, &arg6)) - return NULL; - if (!PyArg_GetLong(args, 6, 4, &arg7)) - return NULL; - if (!PyArg_GetLong(args, 6, 5, &arg8)) - return NULL; - if (arg8 == N_XYZ) - ncoords = 3; - else if (arg8 == N_XYZW) - ncoords = 4; - else { - PyErr_BadArgument(); - return NULL; - } - s_nctl = arg1 - arg6; - t_nctl = arg3 - arg7; - if (!PyArg_GetObject(args, 6, 2, &v)) - return NULL; - if (!PyList_Check(v) || PyList_Size(v) != s_nctl) { - PyErr_BadArgument(); - return NULL; - } - if ((arg5 = PyMem_NEW(double, s_nctl*t_nctl*ncoords )) == NULL) { - return PyErr_NoMemory(); - } - pnext = arg5; - for (s = 0; s < s_nctl; s++) { - w = PyList_GetItem(v, s); - if (w == NULL || !PyList_Check(w) || - PyList_Size(w) != t_nctl) { - PyErr_BadArgument(); - return NULL; - } - for (t = 0; t < t_nctl; t++) { - pt = PyList_GetItem(w, t); - if (!PyArg_GetDoubleArray(pt, 1, 0, ncoords, pnext)) - return NULL; - pnext += ncoords; - } - } - s_byte_stride = sizeof(double) * ncoords; - t_byte_stride = s_byte_stride * s_nctl; - nurbssurface( arg1 , arg2 , arg3 , arg4 , - s_byte_stride , t_byte_stride , arg5 , arg6 , arg7 , arg8 ); - PyMem_DEL(arg2); - PyMem_DEL(arg4); - PyMem_DEL(arg5); - Py_INCREF(Py_None); - return Py_None; -} - -/* nurbscurve(knots, ctlpoints, order, type). - The length of ctlpoints is len(knots)-order. */ - - -static PyObject * -gl_nurbscurve(PyObject *self, PyObject *args) -{ - long arg1 ; - double * arg2 ; - long arg3 ; - double * arg4 ; - long arg5 ; - long arg6 ; - int ncoords, npoints; - int i; - PyObject *v; - double *pnext; - if (!PyArg_GetLongArraySize(args, 4, 0, &arg1)) - return NULL; - if ((arg2 = PyMem_NEW(double, arg1 )) == NULL) { - return PyErr_NoMemory(); - } - if (!PyArg_GetDoubleArray(args, 4, 0, arg1 , arg2)) - return NULL; - if (!PyArg_GetLong(args, 4, 2, &arg5)) - return NULL; - if (!PyArg_GetLong(args, 4, 3, &arg6)) - return NULL; - if (arg6 == N_ST) - ncoords = 2; - else if (arg6 == N_STW) - ncoords = 3; - else { - PyErr_BadArgument(); - return NULL; - } - npoints = arg1 - arg5; - if (!PyArg_GetObject(args, 4, 1, &v)) - return NULL; - if (!PyList_Check(v) || PyList_Size(v) != npoints) { - PyErr_BadArgument(); - return NULL; - } - if ((arg4 = PyMem_NEW(double, npoints*ncoords )) == NULL) { - return PyErr_NoMemory(); - } - pnext = arg4; - for (i = 0; i < npoints; i++) { - if (!PyArg_GetDoubleArray(PyList_GetItem(v, i), 1, 0, ncoords, pnext)) - return NULL; - pnext += ncoords; - } - arg3 = (sizeof(double)) * ncoords; - nurbscurve( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 ); - PyMem_DEL(arg2); - PyMem_DEL(arg4); - Py_INCREF(Py_None); - return Py_None; -} - -/* pwlcurve(points, type). - Points is a list of points. Type must be N_ST. */ - - -static PyObject * -gl_pwlcurve(PyObject *self, PyObject *args) -{ - PyObject *v; - long type; - double *data, *pnext; - long npoints, ncoords; - int i; - if (!PyArg_GetObject(args, 2, 0, &v)) - return NULL; - if (!PyArg_GetLong(args, 2, 1, &type)) - return NULL; - if (!PyList_Check(v)) { - PyErr_BadArgument(); - return NULL; - } - npoints = PyList_Size(v); - if (type == N_ST) - ncoords = 2; - else { - PyErr_BadArgument(); - return NULL; - } - if ((data = PyMem_NEW(double, npoints*ncoords)) == NULL) { - return PyErr_NoMemory(); - } - pnext = data; - for (i = 0; i < npoints; i++) { - if (!PyArg_GetDoubleArray(PyList_GetItem(v, i), 1, 0, ncoords, pnext)) - return NULL; - pnext += ncoords; - } - pwlcurve(npoints, data, sizeof(double)*ncoords, type); - PyMem_DEL(data); - Py_INCREF(Py_None); - return Py_None; -} - - -/* Picking and Selecting */ - -static short *pickbuffer = NULL; -static long pickbuffersize; - -static PyObject * -pick_select(PyObject *args, void (*func)()) -{ - if (!PyArg_GetLong(args, 1, 0, &pickbuffersize)) - return NULL; - if (pickbuffer != NULL) { - PyErr_SetString(PyExc_RuntimeError, - "pick/gselect: already picking/selecting"); - return NULL; - } - if ((pickbuffer = PyMem_NEW(short, pickbuffersize)) == NULL) { - return PyErr_NoMemory(); - } - (*func)(pickbuffer, pickbuffersize); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -endpick_select(long (*func)()) -{ - PyObject *v, *w; - int i, nhits, n; - if (pickbuffer == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "endpick/endselect: not in pick/select mode"); - return NULL; - } - nhits = (*func)(pickbuffer); - if (nhits < 0) { - nhits = -nhits; /* How to report buffer overflow otherwise? */ - } - /* Scan the buffer to see how many integers */ - n = 0; - for (; nhits > 0; nhits--) { - n += 1 + pickbuffer[n]; - } - v = PyList_New(n); - if (v == NULL) - return NULL; - /* XXX Could do it nicer and interpret the data structure here, - returning a list of lists. But this can be done in Python... */ - for (i = 0; i < n; i++) { - w = PyInt_FromLong((long)pickbuffer[i]); - if (w == NULL) { - Py_DECREF(v); - return NULL; - } - PyList_SetItem(v, i, w); - } - PyMem_DEL(pickbuffer); - pickbuffer = NULL; - return v; -} - -extern void pick(), gselect(); -extern long endpick(), endselect(); - -static PyObject *gl_pick(PyObject *self, PyObject *args) -{ - return pick_select(args, pick); -} - -static PyObject *gl_endpick(PyObject *self) -{ - return endpick_select(endpick); -} - -static PyObject *gl_gselect(PyObject *self, PyObject *args) -{ - return pick_select(args, gselect); -} - -static PyObject *gl_endselect(PyObject *self) -{ - return endpick_select(endselect); -} - - -/* XXX The generator botches this one. Here's a quick hack to fix it. */ - -/* XXX The generator botches this one. Here's a quick hack to fix it. */ - - -static PyObject * -gl_getmatrix(PyObject *self, PyObject *args) -{ - Matrix arg1; - PyObject *v, *w; - int i, j; - getmatrix( arg1 ); - v = PyList_New(16); - if (v == NULL) { - return PyErr_NoMemory(); - } - for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) { - w = mknewfloatobject(arg1[i][j]); - if (w == NULL) { - Py_DECREF(v); - return NULL; - } - PyList_SetItem(v, i*4+j, w); - } - return v; -} - -/* Here's an alternate version that returns a 4x4 matrix instead of - a vector. Unfortunately it is incompatible with loadmatrix and - multmatrix... */ - - -static PyObject * -gl_altgetmatrix(PyObject *self, PyObject *args) -{ - Matrix arg1; - PyObject *v, *w; - int i, j; - getmatrix( arg1 ); - v = PyList_New(4); - if (v == NULL) { - return NULL; - } - for (i = 0; i < 4; i++) { - w = PyList_New(4); - if (w == NULL) { - Py_DECREF(v); - return NULL; - } - PyList_SetItem(v, i, w); - } - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - w = mknewfloatobject(arg1[i][j]); - if (w == NULL) { - Py_DECREF(v); - return NULL; - } - PyList_SetItem(PyList_GetItem(v, i), j, w); - } - } - return v; -} - - -static PyObject * -gl_lrectwrite(PyObject *self, PyObject *args) -{ - short x1 ; - short y1 ; - short x2 ; - short y2 ; - string parray ; - PyObject *s; -#if 0 - int pixcount; -#endif - if (!PyArg_GetShort(args, 5, 0, &x1)) - return NULL; - if (!PyArg_GetShort(args, 5, 1, &y1)) - return NULL; - if (!PyArg_GetShort(args, 5, 2, &x2)) - return NULL; - if (!PyArg_GetShort(args, 5, 3, &y2)) - return NULL; - if (!PyArg_GetString(args, 5, 4, &parray)) - return NULL; - if (!PyArg_GetObject(args, 5, 4, &s)) - return NULL; -#if 0 -/* Don't check this, it breaks experiments with pixmode(PM_SIZE, ...) */ - pixcount = (long)(x2+1-x1) * (long)(y2+1-y1); - if (!PyString_Check(s) || PyString_Size(s) != pixcount*sizeof(long)) { - PyErr_SetString(PyExc_RuntimeError, - "string arg to lrectwrite has wrong size"); - return NULL; - } -#endif - lrectwrite( x1 , y1 , x2 , y2 , (unsigned long *) parray ); - Py_INCREF(Py_None); - return Py_None; -} - - -static PyObject * -gl_lrectread(PyObject *self, PyObject *args) -{ - short x1 ; - short y1 ; - short x2 ; - short y2 ; - PyObject *parray; - int pixcount; - if (!PyArg_GetShort(args, 4, 0, &x1)) - return NULL; - if (!PyArg_GetShort(args, 4, 1, &y1)) - return NULL; - if (!PyArg_GetShort(args, 4, 2, &x2)) - return NULL; - if (!PyArg_GetShort(args, 4, 3, &y2)) - return NULL; - pixcount = (long)(x2+1-x1) * (long)(y2+1-y1); - parray = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); - if (parray == NULL) - return NULL; /* No memory */ - lrectread(x1, y1, x2, y2, (unsigned long *) PyString_AsString(parray)); - return parray; -} - - -static PyObject * -gl_readdisplay(PyObject *self, PyObject *args) -{ - short x1, y1, x2, y2; - unsigned long *parray, hints; - long size, size_ret; - PyObject *rv; - - if ( !PyArg_Parse(args, "hhhhl", &x1, &y1, &x2, &y2, &hints) ) - return 0; - size = (long)(x2+1-x1) * (long)(y2+1-y1); - rv = PyString_FromStringAndSize((char *)NULL, size*sizeof(long)); - if ( rv == NULL ) - return NULL; - parray = (unsigned long *)PyString_AsString(rv); - size_ret = readdisplay(x1, y1, x2, y2, parray, hints); - if ( size_ret != size ) { - printf("gl_readdisplay: got %ld pixels, expected %ld\n", - size_ret, size); - PyErr_SetString(PyExc_RuntimeError, "readdisplay returned unexpected length"); - return NULL; - } - return rv; -} - -/* Desperately needed, here are tools to compress and decompress - the data manipulated by lrectread/lrectwrite. - - gl.packrect(width, height, packfactor, bigdata) --> smalldata - makes 'bigdata' 4*(packfactor**2) times smaller by: - - turning it into B/W (a factor 4) - - replacing squares of size pacfactor by one - representative - - gl.unpackrect(width, height, packfactor, smalldata) --> bigdata - is the inverse; the numeric arguments must be *the same*. - - Both work best if width and height are multiples of packfactor - (in fact unpackrect will leave garbage bytes). -*/ - - -static PyObject * -gl_packrect(PyObject *self, PyObject *args) -{ - long width, height, packfactor; - char *s; - PyObject *unpacked, *packed; - int pixcount, packedcount, x, y, r, g, b; - unsigned long pixel; - unsigned char *p; - unsigned long *parray; - if (!PyArg_GetLong(args, 4, 0, &width)) - return NULL; - if (!PyArg_GetLong(args, 4, 1, &height)) - return NULL; - if (!PyArg_GetLong(args, 4, 2, &packfactor)) - return NULL; - if (!PyArg_GetString(args, 4, 3, &s)) /* For type checking only */ - return NULL; - if (!PyArg_GetObject(args, 4, 3, &unpacked)) - return NULL; - if (width <= 0 || height <= 0 || packfactor <= 0) { - PyErr_SetString(PyExc_RuntimeError, "packrect args must be > 0"); - return NULL; - } - pixcount = width*height; - packedcount = ((width+packfactor-1)/packfactor) * - ((height+packfactor-1)/packfactor); - if (PyString_Size(unpacked) != pixcount*sizeof(long)) { - PyErr_SetString(PyExc_RuntimeError, - "string arg to packrect has wrong size"); - return NULL; - } - packed = PyString_FromStringAndSize((char *)NULL, packedcount); - if (packed == NULL) - return NULL; - parray = (unsigned long *) PyString_AsString(unpacked); - p = (unsigned char *) PyString_AsString(packed); - for (y = 0; y < height; y += packfactor, parray += packfactor*width) { - for (x = 0; x < width; x += packfactor) { - pixel = parray[x]; - r = pixel & 0xff; - g = (pixel >> 8) & 0xff; - b = (pixel >> 16) & 0xff; - *p++ = (30*r+59*g+11*b) / 100; - } - } - return packed; -} - - -static unsigned long unpacktab[256]; -static int unpacktab_inited = 0; - -static PyObject * -gl_unpackrect(PyObject *self, PyObject *args) -{ - long width, height, packfactor; - char *s; - PyObject *unpacked, *packed; - int pixcount, packedcount; - register unsigned char *p; - register unsigned long *parray; - if (!unpacktab_inited) { - register int white; - for (white = 256; --white >= 0; ) - unpacktab[white] = white * 0x010101L; - unpacktab_inited++; - } - if (!PyArg_GetLong(args, 4, 0, &width)) - return NULL; - if (!PyArg_GetLong(args, 4, 1, &height)) - return NULL; - if (!PyArg_GetLong(args, 4, 2, &packfactor)) - return NULL; - if (!PyArg_GetString(args, 4, 3, &s)) /* For type checking only */ - return NULL; - if (!PyArg_GetObject(args, 4, 3, &packed)) - return NULL; - if (width <= 0 || height <= 0 || packfactor <= 0) { - PyErr_SetString(PyExc_RuntimeError, "packrect args must be > 0"); - return NULL; - } - pixcount = width*height; - packedcount = ((width+packfactor-1)/packfactor) * - ((height+packfactor-1)/packfactor); - if (PyString_Size(packed) != packedcount) { - PyErr_SetString(PyExc_RuntimeError, - "string arg to unpackrect has wrong size"); - return NULL; - } - unpacked = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); - if (unpacked == NULL) - return NULL; - parray = (unsigned long *) PyString_AsString(unpacked); - p = (unsigned char *) PyString_AsString(packed); - if (packfactor == 1 && width*height > 0) { - /* Just expand bytes to longs */ - register int x = width * height; - do { - *parray++ = unpacktab[*p++]; - } while (--x >= 0); - } - else { - register int y; - for (y = 0; y < height-packfactor+1; - y += packfactor, parray += packfactor*width) { - register int x; - for (x = 0; x < width-packfactor+1; x += packfactor) { - register unsigned long pixel = unpacktab[*p++]; - register int i; - for (i = packfactor*width; (i-=width) >= 0;) { - register int j; - for (j = packfactor; --j >= 0; ) - parray[i+x+j] = pixel; - } - } - } - } - return unpacked; -} - -static PyObject * -gl_gversion(PyObject *self, PyObject *args) -{ - char buf[20]; - gversion(buf); - return PyString_FromString(buf); -} - - -/* void clear - Manual because of clash with termcap */ -static PyObject * -gl_clear(PyObject *self, PyObject *args) -{ - __GLclear( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* End of manually written stubs */ - - -/* long getshade */ - -static PyObject * -gl_getshade(PyObject *self, PyObject *args) -{ - long retval; - retval = getshade( ); - return mknewlongobject(retval); -} - -/* void devport short s long s */ - -static PyObject * -gl_devport(PyObject *self, PyObject *args) -{ - short arg1 ; - long arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - devport( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rdr2i long s long s */ - -static PyObject * -gl_rdr2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - rdr2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rectfs short s short s short s short s */ - -static PyObject * -gl_rectfs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - rectfs( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rects short s short s short s short s */ - -static PyObject * -gl_rects(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - rects( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rmv2i long s long s */ - -static PyObject * -gl_rmv2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - rmv2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void noport */ - -static PyObject * -gl_noport(PyObject *self, PyObject *args) -{ - noport( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void popviewport */ - -static PyObject * -gl_popviewport(PyObject *self, PyObject *args) -{ - popviewport( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void clearhitcode */ - -static PyObject * -gl_clearhitcode(PyObject *self, PyObject *args) -{ - clearhitcode( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void closeobj */ - -static PyObject * -gl_closeobj(PyObject *self, PyObject *args) -{ - closeobj( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cursoff */ - -static PyObject * -gl_cursoff(PyObject *self, PyObject *args) -{ - cursoff( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void curson */ - -static PyObject * -gl_curson(PyObject *self, PyObject *args) -{ - curson( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void doublebuffer */ - -static PyObject * -gl_doublebuffer(PyObject *self, PyObject *args) -{ - doublebuffer( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void finish */ - -static PyObject * -gl_finish(PyObject *self, PyObject *args) -{ - finish( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void gconfig */ - -static PyObject * -gl_gconfig(PyObject *self, PyObject *args) -{ - gconfig( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void ginit */ - -static PyObject * -gl_ginit(PyObject *self, PyObject *args) -{ - ginit( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void greset */ - -static PyObject * -gl_greset(PyObject *self, PyObject *args) -{ - greset( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void multimap */ - -static PyObject * -gl_multimap(PyObject *self, PyObject *args) -{ - multimap( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void onemap */ - -static PyObject * -gl_onemap(PyObject *self, PyObject *args) -{ - onemap( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void popattributes */ - -static PyObject * -gl_popattributes(PyObject *self, PyObject *args) -{ - popattributes( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void popmatrix */ - -static PyObject * -gl_popmatrix(PyObject *self, PyObject *args) -{ - popmatrix( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pushattributes */ - -static PyObject * -gl_pushattributes(PyObject *self, PyObject *args) -{ - pushattributes( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pushmatrix */ - -static PyObject * -gl_pushmatrix(PyObject *self, PyObject *args) -{ - pushmatrix( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pushviewport */ - -static PyObject * -gl_pushviewport(PyObject *self, PyObject *args) -{ - pushviewport( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void qreset */ - -static PyObject * -gl_qreset(PyObject *self, PyObject *args) -{ - qreset( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void RGBmode */ - -static PyObject * -gl_RGBmode(PyObject *self, PyObject *args) -{ - RGBmode( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void singlebuffer */ - -static PyObject * -gl_singlebuffer(PyObject *self, PyObject *args) -{ - singlebuffer( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void swapbuffers */ - -static PyObject * -gl_swapbuffers(PyObject *self, PyObject *args) -{ - swapbuffers( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void gsync */ - -static PyObject * -gl_gsync(PyObject *self, PyObject *args) -{ - gsync( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void gflush */ - -static PyObject * -gl_gflush(PyObject *self, PyObject *args) -{ - gflush( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void tpon */ - -static PyObject * -gl_tpon(PyObject *self, PyObject *args) -{ - tpon( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void tpoff */ - -static PyObject * -gl_tpoff(PyObject *self, PyObject *args) -{ - tpoff( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void clkon */ - -static PyObject * -gl_clkon(PyObject *self, PyObject *args) -{ - clkon( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void clkoff */ - -static PyObject * -gl_clkoff(PyObject *self, PyObject *args) -{ - clkoff( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void ringbell */ - -static PyObject * -gl_ringbell(PyObject *self, PyObject *args) -{ - ringbell( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void gbegin */ - -static PyObject * -gl_gbegin(PyObject *self, PyObject *args) -{ - gbegin( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void textinit */ - -static PyObject * -gl_textinit(PyObject *self, PyObject *args) -{ - textinit( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void initnames */ - -static PyObject * -gl_initnames(PyObject *self, PyObject *args) -{ - initnames( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pclos */ - -static PyObject * -gl_pclos(PyObject *self, PyObject *args) -{ - pclos( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void popname */ - -static PyObject * -gl_popname(PyObject *self, PyObject *args) -{ - popname( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void spclos */ - -static PyObject * -gl_spclos(PyObject *self, PyObject *args) -{ - spclos( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void zclear */ - -static PyObject * -gl_zclear(PyObject *self, PyObject *args) -{ - zclear( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void screenspace */ - -static PyObject * -gl_screenspace(PyObject *self, PyObject *args) -{ - screenspace( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void reshapeviewport */ - -static PyObject * -gl_reshapeviewport(PyObject *self, PyObject *args) -{ - reshapeviewport( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void winpush */ - -static PyObject * -gl_winpush(PyObject *self, PyObject *args) -{ - winpush( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void winpop */ - -static PyObject * -gl_winpop(PyObject *self, PyObject *args) -{ - winpop( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void foreground */ - -static PyObject * -gl_foreground(PyObject *self, PyObject *args) -{ - foreground( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endfullscrn */ - -static PyObject * -gl_endfullscrn(PyObject *self, PyObject *args) -{ - endfullscrn( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endpupmode */ - -static PyObject * -gl_endpupmode(PyObject *self, PyObject *args) -{ - endpupmode( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void fullscrn */ - -static PyObject * -gl_fullscrn(PyObject *self, PyObject *args) -{ - fullscrn( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pupmode */ - -static PyObject * -gl_pupmode(PyObject *self, PyObject *args) -{ - pupmode( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void winconstraints */ - -static PyObject * -gl_winconstraints(PyObject *self, PyObject *args) -{ - winconstraints( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pagecolor short s */ - -static PyObject * -gl_pagecolor(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - pagecolor( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void textcolor short s */ - -static PyObject * -gl_textcolor(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - textcolor( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void color short s */ - -static PyObject * -gl_color(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - color( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void curveit short s */ - -static PyObject * -gl_curveit(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - curveit( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void font short s */ - -static PyObject * -gl_font(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - font( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void linewidth short s */ - -static PyObject * -gl_linewidth(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - linewidth( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setlinestyle short s */ - -static PyObject * -gl_setlinestyle(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - setlinestyle( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setmap short s */ - -static PyObject * -gl_setmap(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - setmap( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void swapinterval short s */ - -static PyObject * -gl_swapinterval(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - swapinterval( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void writemask short s */ - -static PyObject * -gl_writemask(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - writemask( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void textwritemask short s */ - -static PyObject * -gl_textwritemask(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - textwritemask( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void qdevice short s */ - -static PyObject * -gl_qdevice(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - qdevice( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void unqdevice short s */ - -static PyObject * -gl_unqdevice(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - unqdevice( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void curvebasis short s */ - -static PyObject * -gl_curvebasis(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - curvebasis( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void curveprecision short s */ - -static PyObject * -gl_curveprecision(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - curveprecision( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void loadname short s */ - -static PyObject * -gl_loadname(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - loadname( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void passthrough short s */ - -static PyObject * -gl_passthrough(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - passthrough( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pushname short s */ - -static PyObject * -gl_pushname(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - pushname( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setmonitor short s */ - -static PyObject * -gl_setmonitor(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - setmonitor( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setshade short s */ - -static PyObject * -gl_setshade(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - setshade( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setpattern short s */ - -static PyObject * -gl_setpattern(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - setpattern( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pagewritemask short s */ - -static PyObject * -gl_pagewritemask(PyObject *self, PyObject *args) -{ - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - pagewritemask( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void callobj long s */ - -static PyObject * -gl_callobj(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - callobj( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void delobj long s */ - -static PyObject * -gl_delobj(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - delobj( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void editobj long s */ - -static PyObject * -gl_editobj(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - editobj( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void makeobj long s */ - -static PyObject * -gl_makeobj(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - makeobj( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void maketag long s */ - -static PyObject * -gl_maketag(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - maketag( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void chunksize long s */ - -static PyObject * -gl_chunksize(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - chunksize( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void compactify long s */ - -static PyObject * -gl_compactify(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - compactify( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void deltag long s */ - -static PyObject * -gl_deltag(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - deltag( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lsrepeat long s */ - -static PyObject * -gl_lsrepeat(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - lsrepeat( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void objinsert long s */ - -static PyObject * -gl_objinsert(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - objinsert( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void objreplace long s */ - -static PyObject * -gl_objreplace(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - objreplace( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void winclose long s */ - -static PyObject * -gl_winclose(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - winclose( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void blanktime long s */ - -static PyObject * -gl_blanktime(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - blanktime( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void freepup long s */ - -static PyObject * -gl_freepup(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - freepup( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void backbuffer long s */ - -static PyObject * -gl_backbuffer(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - backbuffer( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void frontbuffer long s */ - -static PyObject * -gl_frontbuffer(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - frontbuffer( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lsbackup long s */ - -static PyObject * -gl_lsbackup(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - lsbackup( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void resetls long s */ - -static PyObject * -gl_resetls(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - resetls( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lampon long s */ - -static PyObject * -gl_lampon(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - lampon( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lampoff long s */ - -static PyObject * -gl_lampoff(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - lampoff( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setbell long s */ - -static PyObject * -gl_setbell(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - setbell( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void blankscreen long s */ - -static PyObject * -gl_blankscreen(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - blankscreen( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void depthcue long s */ - -static PyObject * -gl_depthcue(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - depthcue( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void zbuffer long s */ - -static PyObject * -gl_zbuffer(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - zbuffer( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void backface long s */ - -static PyObject * -gl_backface(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - backface( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cmov2i long s long s */ - -static PyObject * -gl_cmov2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - cmov2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void draw2i long s long s */ - -static PyObject * -gl_draw2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - draw2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void move2i long s long s */ - -static PyObject * -gl_move2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - move2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pnt2i long s long s */ - -static PyObject * -gl_pnt2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - pnt2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void patchbasis long s long s */ - -static PyObject * -gl_patchbasis(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - patchbasis( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void patchprecision long s long s */ - -static PyObject * -gl_patchprecision(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - patchprecision( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pdr2i long s long s */ - -static PyObject * -gl_pdr2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - pdr2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pmv2i long s long s */ - -static PyObject * -gl_pmv2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - pmv2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpdr2i long s long s */ - -static PyObject * -gl_rpdr2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - rpdr2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpmv2i long s long s */ - -static PyObject * -gl_rpmv2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - rpmv2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpt2i long s long s */ - -static PyObject * -gl_xfpt2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - xfpt2i( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void objdelete long s long s */ - -static PyObject * -gl_objdelete(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - objdelete( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void patchcurves long s long s */ - -static PyObject * -gl_patchcurves(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - patchcurves( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void minsize long s long s */ - -static PyObject * -gl_minsize(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - minsize( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void maxsize long s long s */ - -static PyObject * -gl_maxsize(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - maxsize( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void keepaspect long s long s */ - -static PyObject * -gl_keepaspect(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - keepaspect( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void prefsize long s long s */ - -static PyObject * -gl_prefsize(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - prefsize( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void stepunit long s long s */ - -static PyObject * -gl_stepunit(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - stepunit( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void fudge long s long s */ - -static PyObject * -gl_fudge(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - fudge( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void winmove long s long s */ - -static PyObject * -gl_winmove(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - winmove( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void attachcursor short s short s */ - -static PyObject * -gl_attachcursor(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - attachcursor( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void deflinestyle short s short s */ - -static PyObject * -gl_deflinestyle(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - deflinestyle( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void noise short s short s */ - -static PyObject * -gl_noise(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - noise( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void picksize short s short s */ - -static PyObject * -gl_picksize(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - picksize( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void qenter short s short s */ - -static PyObject * -gl_qenter(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - qenter( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setdepth short s short s */ - -static PyObject * -gl_setdepth(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - setdepth( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cmov2s short s short s */ - -static PyObject * -gl_cmov2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - cmov2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void draw2s short s short s */ - -static PyObject * -gl_draw2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - draw2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void move2s short s short s */ - -static PyObject * -gl_move2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - move2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pdr2s short s short s */ - -static PyObject * -gl_pdr2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - pdr2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pmv2s short s short s */ - -static PyObject * -gl_pmv2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - pmv2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pnt2s short s short s */ - -static PyObject * -gl_pnt2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - pnt2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rdr2s short s short s */ - -static PyObject * -gl_rdr2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - rdr2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rmv2s short s short s */ - -static PyObject * -gl_rmv2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - rmv2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpdr2s short s short s */ - -static PyObject * -gl_rpdr2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - rpdr2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpmv2s short s short s */ - -static PyObject * -gl_rpmv2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - rpmv2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpt2s short s short s */ - -static PyObject * -gl_xfpt2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - xfpt2s( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cmov2 float s float s */ - -static PyObject * -gl_cmov2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - cmov2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void draw2 float s float s */ - -static PyObject * -gl_draw2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - draw2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void move2 float s float s */ - -static PyObject * -gl_move2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - move2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pnt2 float s float s */ - -static PyObject * -gl_pnt2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - pnt2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pdr2 float s float s */ - -static PyObject * -gl_pdr2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - pdr2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pmv2 float s float s */ - -static PyObject * -gl_pmv2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - pmv2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rdr2 float s float s */ - -static PyObject * -gl_rdr2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - rdr2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rmv2 float s float s */ - -static PyObject * -gl_rmv2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - rmv2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpdr2 float s float s */ - -static PyObject * -gl_rpdr2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - rpdr2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpmv2 float s float s */ - -static PyObject * -gl_rpmv2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - rpmv2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpt2 float s float s */ - -static PyObject * -gl_xfpt2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - xfpt2( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void loadmatrix float s[4*4] */ - -static PyObject * -gl_loadmatrix(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] [ 4 ] ; - if (!getifloatarray(args, 1, 0, 4 * 4 , (float *) arg1)) - return NULL; - loadmatrix( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void multmatrix float s[4*4] */ - -static PyObject * -gl_multmatrix(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] [ 4 ] ; - if (!getifloatarray(args, 1, 0, 4 * 4 , (float *) arg1)) - return NULL; - multmatrix( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void crv float s[3*4] */ - -static PyObject * -gl_crv(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] [ 3 ] ; - if (!getifloatarray(args, 1, 0, 3 * 4 , (float *) arg1)) - return NULL; - crv( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rcrv float s[4*4] */ - -static PyObject * -gl_rcrv(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] [ 4 ] ; - if (!getifloatarray(args, 1, 0, 4 * 4 , (float *) arg1)) - return NULL; - rcrv( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void addtopup long s char *s long s */ - -static PyObject * -gl_addtopup(PyObject *self, PyObject *args) -{ - long arg1 ; - string arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getistringarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - addtopup( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void charstr char *s */ - -static PyObject * -gl_charstr(PyObject *self, PyObject *args) -{ - string arg1 ; - if (!getistringarg(args, 1, 0, &arg1)) - return NULL; - charstr( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void getport char *s */ - -static PyObject * -gl_getport(PyObject *self, PyObject *args) -{ - string arg1 ; - if (!getistringarg(args, 1, 0, &arg1)) - return NULL; - getport( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long strwidth char *s */ - -static PyObject * -gl_strwidth(PyObject *self, PyObject *args) -{ - long retval; - string arg1 ; - if (!getistringarg(args, 1, 0, &arg1)) - return NULL; - retval = strwidth( arg1 ); - return mknewlongobject(retval); -} - -/* long winopen char *s */ - -static PyObject * -gl_winopen(PyObject *self, PyObject *args) -{ - long retval; - string arg1 ; - if (!getistringarg(args, 1, 0, &arg1)) - return NULL; - retval = winopen( arg1 ); - return mknewlongobject(retval); -} - -/* void wintitle char *s */ - -static PyObject * -gl_wintitle(PyObject *self, PyObject *args) -{ - string arg1 ; - if (!getistringarg(args, 1, 0, &arg1)) - return NULL; - wintitle( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polf long s float s[3*arg1] */ - -static PyObject * -gl_polf(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 3 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (float(*)[3]) PyMem_NEW(float , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 1, 0, 3 * arg1 , (float *) arg2)) - return NULL; - polf( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polf2 long s float s[2*arg1] */ - -static PyObject * -gl_polf2(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 2 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (float(*)[2]) PyMem_NEW(float , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 1, 0, 2 * arg1 , (float *) arg2)) - return NULL; - polf2( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void poly long s float s[3*arg1] */ - -static PyObject * -gl_poly(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 3 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (float(*)[3]) PyMem_NEW(float , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 1, 0, 3 * arg1 , (float *) arg2)) - return NULL; - poly( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void poly2 long s float s[2*arg1] */ - -static PyObject * -gl_poly2(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 2 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (float(*)[2]) PyMem_NEW(float , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 1, 0, 2 * arg1 , (float *) arg2)) - return NULL; - poly2( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void crvn long s float s[3*arg1] */ - -static PyObject * -gl_crvn(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 3 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (float(*)[3]) PyMem_NEW(float , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 1, 0, 3 * arg1 , (float *) arg2)) - return NULL; - crvn( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rcrvn long s float s[4*arg1] */ - -static PyObject * -gl_rcrvn(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 4 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 4; - if ((arg2 = (float(*)[4]) PyMem_NEW(float , 4 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 1, 0, 4 * arg1 , (float *) arg2)) - return NULL; - rcrvn( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polf2i long s long s[2*arg1] */ - -static PyObject * -gl_polf2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long (* arg2) [ 2 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (long(*)[2]) PyMem_NEW(long , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getilongarray(args, 1, 0, 2 * arg1 , (long *) arg2)) - return NULL; - polf2i( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polfi long s long s[3*arg1] */ - -static PyObject * -gl_polfi(PyObject *self, PyObject *args) -{ - long arg1 ; - long (* arg2) [ 3 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (long(*)[3]) PyMem_NEW(long , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getilongarray(args, 1, 0, 3 * arg1 , (long *) arg2)) - return NULL; - polfi( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void poly2i long s long s[2*arg1] */ - -static PyObject * -gl_poly2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long (* arg2) [ 2 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (long(*)[2]) PyMem_NEW(long , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getilongarray(args, 1, 0, 2 * arg1 , (long *) arg2)) - return NULL; - poly2i( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polyi long s long s[3*arg1] */ - -static PyObject * -gl_polyi(PyObject *self, PyObject *args) -{ - long arg1 ; - long (* arg2) [ 3 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (long(*)[3]) PyMem_NEW(long , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getilongarray(args, 1, 0, 3 * arg1 , (long *) arg2)) - return NULL; - polyi( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polf2s long s short s[2*arg1] */ - -static PyObject * -gl_polf2s(PyObject *self, PyObject *args) -{ - long arg1 ; - short (* arg2) [ 2 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (short(*)[2]) PyMem_NEW(short , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 1, 0, 2 * arg1 , (short *) arg2)) - return NULL; - polf2s( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polfs long s short s[3*arg1] */ - -static PyObject * -gl_polfs(PyObject *self, PyObject *args) -{ - long arg1 ; - short (* arg2) [ 3 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (short(*)[3]) PyMem_NEW(short , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 1, 0, 3 * arg1 , (short *) arg2)) - return NULL; - polfs( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polys long s short s[3*arg1] */ - -static PyObject * -gl_polys(PyObject *self, PyObject *args) -{ - long arg1 ; - short (* arg2) [ 3 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (short(*)[3]) PyMem_NEW(short , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 1, 0, 3 * arg1 , (short *) arg2)) - return NULL; - polys( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void poly2s long s short s[2*arg1] */ - -static PyObject * -gl_poly2s(PyObject *self, PyObject *args) -{ - long arg1 ; - short (* arg2) [ 2 ] ; - if (!getilongarraysize(args, 1, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (short(*)[2]) PyMem_NEW(short , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 1, 0, 2 * arg1 , (short *) arg2)) - return NULL; - poly2s( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void defcursor short s u_short s[128] */ - -static PyObject * -gl_defcursor(PyObject *self, PyObject *args) -{ - short arg1 ; - unsigned short arg2 [ 128 ] ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarray(args, 2, 1, 128 , (short *) arg2)) - return NULL; - defcursor( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void writepixels short s u_short s[arg1] */ - -static PyObject * -gl_writepixels(PyObject *self, PyObject *args) -{ - short arg1 ; - unsigned short * arg2 ; - if (!getishortarraysize(args, 1, 0, &arg1)) - return NULL; - if ((arg2 = PyMem_NEW(unsigned short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 1, 0, arg1 , (short *) arg2)) - return NULL; - writepixels( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void defbasis long s float s[4*4] */ - -static PyObject * -gl_defbasis(PyObject *self, PyObject *args) -{ - long arg1 ; - float arg2 [ 4 ] [ 4 ] ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarray(args, 2, 1, 4 * 4 , (float *) arg2)) - return NULL; - defbasis( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void gewrite short s short s[arg1] */ - -static PyObject * -gl_gewrite(PyObject *self, PyObject *args) -{ - short arg1 ; - short * arg2 ; - if (!getishortarraysize(args, 1, 0, &arg1)) - return NULL; - if ((arg2 = PyMem_NEW(short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 1, 0, arg1 , arg2)) - return NULL; - gewrite( arg1 , arg2 ); - PyMem_DEL(arg2); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rotate short s char s */ - -static PyObject * -gl_rotate(PyObject *self, PyObject *args) -{ - short arg1 ; - char arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getichararg(args, 2, 1, &arg2)) - return NULL; - rotate( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rot float s char s */ - -static PyObject * -gl_rot(PyObject *self, PyObject *args) -{ - float arg1 ; - char arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getichararg(args, 2, 1, &arg2)) - return NULL; - rot( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void circfi long s long s long s */ - -static PyObject * -gl_circfi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - circfi( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void circi long s long s long s */ - -static PyObject * -gl_circi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - circi( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cmovi long s long s long s */ - -static PyObject * -gl_cmovi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - cmovi( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void drawi long s long s long s */ - -static PyObject * -gl_drawi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - drawi( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void movei long s long s long s */ - -static PyObject * -gl_movei(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - movei( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pnti long s long s long s */ - -static PyObject * -gl_pnti(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - pnti( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void newtag long s long s long s */ - -static PyObject * -gl_newtag(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - newtag( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pdri long s long s long s */ - -static PyObject * -gl_pdri(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - pdri( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pmvi long s long s long s */ - -static PyObject * -gl_pmvi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - pmvi( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rdri long s long s long s */ - -static PyObject * -gl_rdri(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - rdri( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rmvi long s long s long s */ - -static PyObject * -gl_rmvi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - rmvi( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpdri long s long s long s */ - -static PyObject * -gl_rpdri(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - rpdri( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpmvi long s long s long s */ - -static PyObject * -gl_rpmvi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - rpmvi( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpti long s long s long s */ - -static PyObject * -gl_xfpti(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - xfpti( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void circ float s float s float s */ - -static PyObject * -gl_circ(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - circ( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void circf float s float s float s */ - -static PyObject * -gl_circf(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - circf( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cmov float s float s float s */ - -static PyObject * -gl_cmov(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - cmov( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void draw float s float s float s */ - -static PyObject * -gl_draw(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - draw( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void move float s float s float s */ - -static PyObject * -gl_move(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - move( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pnt float s float s float s */ - -static PyObject * -gl_pnt(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - pnt( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void scale float s float s float s */ - -static PyObject * -gl_scale(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - scale( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void translate float s float s float s */ - -static PyObject * -gl_translate(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - translate( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pdr float s float s float s */ - -static PyObject * -gl_pdr(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - pdr( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pmv float s float s float s */ - -static PyObject * -gl_pmv(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - pmv( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rdr float s float s float s */ - -static PyObject * -gl_rdr(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - rdr( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rmv float s float s float s */ - -static PyObject * -gl_rmv(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - rmv( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpdr float s float s float s */ - -static PyObject * -gl_rpdr(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - rpdr( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpmv float s float s float s */ - -static PyObject * -gl_rpmv(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - rpmv( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpt float s float s float s */ - -static PyObject * -gl_xfpt(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - if (!getifloatarg(args, 3, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 3, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 3, 2, &arg3)) - return NULL; - xfpt( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void RGBcolor short s short s short s */ - -static PyObject * -gl_RGBcolor(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - RGBcolor( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void RGBwritemask short s short s short s */ - -static PyObject * -gl_RGBwritemask(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - RGBwritemask( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setcursor short s short s short s */ - -static PyObject * -gl_setcursor(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - setcursor( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void tie short s short s short s */ - -static PyObject * -gl_tie(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - tie( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void circfs short s short s short s */ - -static PyObject * -gl_circfs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - circfs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void circs short s short s short s */ - -static PyObject * -gl_circs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - circs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cmovs short s short s short s */ - -static PyObject * -gl_cmovs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - cmovs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void draws short s short s short s */ - -static PyObject * -gl_draws(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - draws( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void moves short s short s short s */ - -static PyObject * -gl_moves(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - moves( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pdrs short s short s short s */ - -static PyObject * -gl_pdrs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - pdrs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pmvs short s short s short s */ - -static PyObject * -gl_pmvs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - pmvs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pnts short s short s short s */ - -static PyObject * -gl_pnts(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - pnts( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rdrs short s short s short s */ - -static PyObject * -gl_rdrs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - rdrs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rmvs short s short s short s */ - -static PyObject * -gl_rmvs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - rmvs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpdrs short s short s short s */ - -static PyObject * -gl_rpdrs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - rpdrs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpmvs short s short s short s */ - -static PyObject * -gl_rpmvs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - rpmvs( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpts short s short s short s */ - -static PyObject * -gl_xfpts(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - xfpts( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void curorigin short s short s short s */ - -static PyObject * -gl_curorigin(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - curorigin( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cyclemap short s short s short s */ - -static PyObject * -gl_cyclemap(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - if (!getishortarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - cyclemap( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void patch float s[4*4] float s[4*4] float s[4*4] */ - -static PyObject * -gl_patch(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] [ 4 ] ; - float arg2 [ 4 ] [ 4 ] ; - float arg3 [ 4 ] [ 4 ] ; - if (!getifloatarray(args, 3, 0, 4 * 4 , (float *) arg1)) - return NULL; - if (!getifloatarray(args, 3, 1, 4 * 4 , (float *) arg2)) - return NULL; - if (!getifloatarray(args, 3, 2, 4 * 4 , (float *) arg3)) - return NULL; - patch( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void splf long s float s[3*arg1] u_short s[arg1] */ - -static PyObject * -gl_splf(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 3 ] ; - unsigned short * arg3 ; - if (!getilongarraysize(args, 2, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (float(*)[3]) PyMem_NEW(float , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 2, 0, 3 * arg1 , (float *) arg2)) - return NULL; - if ((arg3 = PyMem_NEW(unsigned short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 1, arg1 , (short *) arg3)) - return NULL; - splf( arg1 , arg2 , arg3 ); - PyMem_DEL(arg2); - PyMem_DEL(arg3); - Py_INCREF(Py_None); - return Py_None; -} - -/* void splf2 long s float s[2*arg1] u_short s[arg1] */ - -static PyObject * -gl_splf2(PyObject *self, PyObject *args) -{ - long arg1 ; - float (* arg2) [ 2 ] ; - unsigned short * arg3 ; - if (!getilongarraysize(args, 2, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (float(*)[2]) PyMem_NEW(float , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 2, 0, 2 * arg1 , (float *) arg2)) - return NULL; - if ((arg3 = PyMem_NEW(unsigned short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 1, arg1 , (short *) arg3)) - return NULL; - splf2( arg1 , arg2 , arg3 ); - PyMem_DEL(arg2); - PyMem_DEL(arg3); - Py_INCREF(Py_None); - return Py_None; -} - -/* void splfi long s long s[3*arg1] u_short s[arg1] */ - -static PyObject * -gl_splfi(PyObject *self, PyObject *args) -{ - long arg1 ; - long (* arg2) [ 3 ] ; - unsigned short * arg3 ; - if (!getilongarraysize(args, 2, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (long(*)[3]) PyMem_NEW(long , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getilongarray(args, 2, 0, 3 * arg1 , (long *) arg2)) - return NULL; - if ((arg3 = PyMem_NEW(unsigned short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 1, arg1 , (short *) arg3)) - return NULL; - splfi( arg1 , arg2 , arg3 ); - PyMem_DEL(arg2); - PyMem_DEL(arg3); - Py_INCREF(Py_None); - return Py_None; -} - -/* void splf2i long s long s[2*arg1] u_short s[arg1] */ - -static PyObject * -gl_splf2i(PyObject *self, PyObject *args) -{ - long arg1 ; - long (* arg2) [ 2 ] ; - unsigned short * arg3 ; - if (!getilongarraysize(args, 2, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (long(*)[2]) PyMem_NEW(long , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getilongarray(args, 2, 0, 2 * arg1 , (long *) arg2)) - return NULL; - if ((arg3 = PyMem_NEW(unsigned short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 1, arg1 , (short *) arg3)) - return NULL; - splf2i( arg1 , arg2 , arg3 ); - PyMem_DEL(arg2); - PyMem_DEL(arg3); - Py_INCREF(Py_None); - return Py_None; -} - -/* void splfs long s short s[3*arg1] u_short s[arg1] */ - -static PyObject * -gl_splfs(PyObject *self, PyObject *args) -{ - long arg1 ; - short (* arg2) [ 3 ] ; - unsigned short * arg3 ; - if (!getilongarraysize(args, 2, 0, &arg1)) - return NULL; - arg1 = arg1 / 3; - if ((arg2 = (short(*)[3]) PyMem_NEW(short , 3 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 0, 3 * arg1 , (short *) arg2)) - return NULL; - if ((arg3 = PyMem_NEW(unsigned short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 1, arg1 , (short *) arg3)) - return NULL; - splfs( arg1 , arg2 , arg3 ); - PyMem_DEL(arg2); - PyMem_DEL(arg3); - Py_INCREF(Py_None); - return Py_None; -} - -/* void splf2s long s short s[2*arg1] u_short s[arg1] */ - -static PyObject * -gl_splf2s(PyObject *self, PyObject *args) -{ - long arg1 ; - short (* arg2) [ 2 ] ; - unsigned short * arg3 ; - if (!getilongarraysize(args, 2, 0, &arg1)) - return NULL; - arg1 = arg1 / 2; - if ((arg2 = (short(*)[2]) PyMem_NEW(short , 2 * arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 0, 2 * arg1 , (short *) arg2)) - return NULL; - if ((arg3 = PyMem_NEW(unsigned short , arg1 )) == NULL) - return PyErr_NoMemory(); - if (!getishortarray(args, 2, 1, arg1 , (short *) arg3)) - return NULL; - splf2s( arg1 , arg2 , arg3 ); - PyMem_DEL(arg2); - PyMem_DEL(arg3); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rpatch float s[4*4] float s[4*4] float s[4*4] float s[4*4] */ - -static PyObject * -gl_rpatch(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] [ 4 ] ; - float arg2 [ 4 ] [ 4 ] ; - float arg3 [ 4 ] [ 4 ] ; - float arg4 [ 4 ] [ 4 ] ; - if (!getifloatarray(args, 4, 0, 4 * 4 , (float *) arg1)) - return NULL; - if (!getifloatarray(args, 4, 1, 4 * 4 , (float *) arg2)) - return NULL; - if (!getifloatarray(args, 4, 2, 4 * 4 , (float *) arg3)) - return NULL; - if (!getifloatarray(args, 4, 3, 4 * 4 , (float *) arg4)) - return NULL; - rpatch( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void ortho2 float s float s float s float s */ - -static PyObject * -gl_ortho2(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - if (!getifloatarg(args, 4, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 4, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 4, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 4, 3, &arg4)) - return NULL; - ortho2( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rect float s float s float s float s */ - -static PyObject * -gl_rect(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - if (!getifloatarg(args, 4, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 4, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 4, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 4, 3, &arg4)) - return NULL; - rect( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rectf float s float s float s float s */ - -static PyObject * -gl_rectf(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - if (!getifloatarg(args, 4, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 4, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 4, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 4, 3, &arg4)) - return NULL; - rectf( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpt4 float s float s float s float s */ - -static PyObject * -gl_xfpt4(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - if (!getifloatarg(args, 4, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 4, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 4, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 4, 3, &arg4)) - return NULL; - xfpt4( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void textport short s short s short s short s */ - -static PyObject * -gl_textport(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - textport( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void mapcolor short s short s short s short s */ - -static PyObject * -gl_mapcolor(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - mapcolor( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void scrmask short s short s short s short s */ - -static PyObject * -gl_scrmask(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - scrmask( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setvaluator short s short s short s short s */ - -static PyObject * -gl_setvaluator(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - setvaluator( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void viewport short s short s short s short s */ - -static PyObject * -gl_viewport(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - viewport( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void shaderange short s short s short s short s */ - -static PyObject * -gl_shaderange(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - shaderange( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpt4s short s short s short s short s */ - -static PyObject * -gl_xfpt4s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - xfpt4s( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rectfi long s long s long s long s */ - -static PyObject * -gl_rectfi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - long arg4 ; - if (!getilongarg(args, 4, 0, &arg1)) - return NULL; - if (!getilongarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - rectfi( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void recti long s long s long s long s */ - -static PyObject * -gl_recti(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - long arg4 ; - if (!getilongarg(args, 4, 0, &arg1)) - return NULL; - if (!getilongarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - recti( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void xfpt4i long s long s long s long s */ - -static PyObject * -gl_xfpt4i(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - long arg4 ; - if (!getilongarg(args, 4, 0, &arg1)) - return NULL; - if (!getilongarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - xfpt4i( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void prefposition long s long s long s long s */ - -static PyObject * -gl_prefposition(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - long arg4 ; - if (!getilongarg(args, 4, 0, &arg1)) - return NULL; - if (!getilongarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - prefposition( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void arc float s float s float s short s short s */ - -static PyObject * -gl_arc(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - short arg4 ; - short arg5 ; - if (!getifloatarg(args, 5, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 5, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 5, 2, &arg3)) - return NULL; - if (!getishortarg(args, 5, 3, &arg4)) - return NULL; - if (!getishortarg(args, 5, 4, &arg5)) - return NULL; - arc( arg1 , arg2 , arg3 , arg4 , arg5 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void arcf float s float s float s short s short s */ - -static PyObject * -gl_arcf(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - short arg4 ; - short arg5 ; - if (!getifloatarg(args, 5, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 5, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 5, 2, &arg3)) - return NULL; - if (!getishortarg(args, 5, 3, &arg4)) - return NULL; - if (!getishortarg(args, 5, 4, &arg5)) - return NULL; - arcf( arg1 , arg2 , arg3 , arg4 , arg5 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void arcfi long s long s long s short s short s */ - -static PyObject * -gl_arcfi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - short arg4 ; - short arg5 ; - if (!getilongarg(args, 5, 0, &arg1)) - return NULL; - if (!getilongarg(args, 5, 1, &arg2)) - return NULL; - if (!getilongarg(args, 5, 2, &arg3)) - return NULL; - if (!getishortarg(args, 5, 3, &arg4)) - return NULL; - if (!getishortarg(args, 5, 4, &arg5)) - return NULL; - arcfi( arg1 , arg2 , arg3 , arg4 , arg5 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void arci long s long s long s short s short s */ - -static PyObject * -gl_arci(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - short arg4 ; - short arg5 ; - if (!getilongarg(args, 5, 0, &arg1)) - return NULL; - if (!getilongarg(args, 5, 1, &arg2)) - return NULL; - if (!getilongarg(args, 5, 2, &arg3)) - return NULL; - if (!getishortarg(args, 5, 3, &arg4)) - return NULL; - if (!getishortarg(args, 5, 4, &arg5)) - return NULL; - arci( arg1 , arg2 , arg3 , arg4 , arg5 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bbox2 short s short s float s float s float s float s */ - -static PyObject * -gl_bbox2(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - float arg3 ; - float arg4 ; - float arg5 ; - float arg6 ; - if (!getishortarg(args, 6, 0, &arg1)) - return NULL; - if (!getishortarg(args, 6, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 6, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 6, 3, &arg4)) - return NULL; - if (!getifloatarg(args, 6, 4, &arg5)) - return NULL; - if (!getifloatarg(args, 6, 5, &arg6)) - return NULL; - bbox2( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bbox2i short s short s long s long s long s long s */ - -static PyObject * -gl_bbox2i(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - long arg3 ; - long arg4 ; - long arg5 ; - long arg6 ; - if (!getishortarg(args, 6, 0, &arg1)) - return NULL; - if (!getishortarg(args, 6, 1, &arg2)) - return NULL; - if (!getilongarg(args, 6, 2, &arg3)) - return NULL; - if (!getilongarg(args, 6, 3, &arg4)) - return NULL; - if (!getilongarg(args, 6, 4, &arg5)) - return NULL; - if (!getilongarg(args, 6, 5, &arg6)) - return NULL; - bbox2i( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bbox2s short s short s short s short s short s short s */ - -static PyObject * -gl_bbox2s(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - short arg6 ; - if (!getishortarg(args, 6, 0, &arg1)) - return NULL; - if (!getishortarg(args, 6, 1, &arg2)) - return NULL; - if (!getishortarg(args, 6, 2, &arg3)) - return NULL; - if (!getishortarg(args, 6, 3, &arg4)) - return NULL; - if (!getishortarg(args, 6, 4, &arg5)) - return NULL; - if (!getishortarg(args, 6, 5, &arg6)) - return NULL; - bbox2s( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void blink short s short s short s short s short s */ - -static PyObject * -gl_blink(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - if (!getishortarg(args, 5, 0, &arg1)) - return NULL; - if (!getishortarg(args, 5, 1, &arg2)) - return NULL; - if (!getishortarg(args, 5, 2, &arg3)) - return NULL; - if (!getishortarg(args, 5, 3, &arg4)) - return NULL; - if (!getishortarg(args, 5, 4, &arg5)) - return NULL; - blink( arg1 , arg2 , arg3 , arg4 , arg5 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void ortho float s float s float s float s float s float s */ - -static PyObject * -gl_ortho(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - float arg5 ; - float arg6 ; - if (!getifloatarg(args, 6, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 6, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 6, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 6, 3, &arg4)) - return NULL; - if (!getifloatarg(args, 6, 4, &arg5)) - return NULL; - if (!getifloatarg(args, 6, 5, &arg6)) - return NULL; - ortho( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void window float s float s float s float s float s float s */ - -static PyObject * -gl_window(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - float arg5 ; - float arg6 ; - if (!getifloatarg(args, 6, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 6, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 6, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 6, 3, &arg4)) - return NULL; - if (!getifloatarg(args, 6, 4, &arg5)) - return NULL; - if (!getifloatarg(args, 6, 5, &arg6)) - return NULL; - window( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lookat float s float s float s float s float s float s short s */ - -static PyObject * -gl_lookat(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - float arg5 ; - float arg6 ; - short arg7 ; - if (!getifloatarg(args, 7, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 7, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 7, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 7, 3, &arg4)) - return NULL; - if (!getifloatarg(args, 7, 4, &arg5)) - return NULL; - if (!getifloatarg(args, 7, 5, &arg6)) - return NULL; - if (!getishortarg(args, 7, 6, &arg7)) - return NULL; - lookat( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void perspective short s float s float s float s */ - -static PyObject * -gl_perspective(PyObject *self, PyObject *args) -{ - short arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 4, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 4, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 4, 3, &arg4)) - return NULL; - perspective( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void polarview float s short s short s short s */ - -static PyObject * -gl_polarview(PyObject *self, PyObject *args) -{ - float arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getifloatarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - polarview( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void arcfs short s short s short s short s short s */ - -static PyObject * -gl_arcfs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - if (!getishortarg(args, 5, 0, &arg1)) - return NULL; - if (!getishortarg(args, 5, 1, &arg2)) - return NULL; - if (!getishortarg(args, 5, 2, &arg3)) - return NULL; - if (!getishortarg(args, 5, 3, &arg4)) - return NULL; - if (!getishortarg(args, 5, 4, &arg5)) - return NULL; - arcfs( arg1 , arg2 , arg3 , arg4 , arg5 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void arcs short s short s short s short s short s */ - -static PyObject * -gl_arcs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - if (!getishortarg(args, 5, 0, &arg1)) - return NULL; - if (!getishortarg(args, 5, 1, &arg2)) - return NULL; - if (!getishortarg(args, 5, 2, &arg3)) - return NULL; - if (!getishortarg(args, 5, 3, &arg4)) - return NULL; - if (!getishortarg(args, 5, 4, &arg5)) - return NULL; - arcs( arg1 , arg2 , arg3 , arg4 , arg5 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rectcopy short s short s short s short s short s short s */ - -static PyObject * -gl_rectcopy(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - short arg6 ; - if (!getishortarg(args, 6, 0, &arg1)) - return NULL; - if (!getishortarg(args, 6, 1, &arg2)) - return NULL; - if (!getishortarg(args, 6, 2, &arg3)) - return NULL; - if (!getishortarg(args, 6, 3, &arg4)) - return NULL; - if (!getishortarg(args, 6, 4, &arg5)) - return NULL; - if (!getishortarg(args, 6, 5, &arg6)) - return NULL; - rectcopy( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void RGBcursor short s short s short s short s short s short s short s */ - -static PyObject * -gl_RGBcursor(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - short arg6 ; - short arg7 ; - if (!getishortarg(args, 7, 0, &arg1)) - return NULL; - if (!getishortarg(args, 7, 1, &arg2)) - return NULL; - if (!getishortarg(args, 7, 2, &arg3)) - return NULL; - if (!getishortarg(args, 7, 3, &arg4)) - return NULL; - if (!getishortarg(args, 7, 4, &arg5)) - return NULL; - if (!getishortarg(args, 7, 5, &arg6)) - return NULL; - if (!getishortarg(args, 7, 6, &arg7)) - return NULL; - RGBcursor( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long getbutton short s */ - -static PyObject * -gl_getbutton(PyObject *self, PyObject *args) -{ - long retval; - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - retval = getbutton( arg1 ); - return mknewlongobject(retval); -} - -/* long getcmmode */ - -static PyObject * -gl_getcmmode(PyObject *self, PyObject *args) -{ - long retval; - retval = getcmmode( ); - return mknewlongobject(retval); -} - -/* long getlsbackup */ - -static PyObject * -gl_getlsbackup(PyObject *self, PyObject *args) -{ - long retval; - retval = getlsbackup( ); - return mknewlongobject(retval); -} - -/* long getresetls */ - -static PyObject * -gl_getresetls(PyObject *self, PyObject *args) -{ - long retval; - retval = getresetls( ); - return mknewlongobject(retval); -} - -/* long getdcm */ - -static PyObject * -gl_getdcm(PyObject *self, PyObject *args) -{ - long retval; - retval = getdcm( ); - return mknewlongobject(retval); -} - -/* long getzbuffer */ - -static PyObject * -gl_getzbuffer(PyObject *self, PyObject *args) -{ - long retval; - retval = getzbuffer( ); - return mknewlongobject(retval); -} - -/* long ismex */ - -static PyObject * -gl_ismex(PyObject *self, PyObject *args) -{ - long retval; - retval = ismex( ); - return mknewlongobject(retval); -} - -/* long isobj long s */ - -static PyObject * -gl_isobj(PyObject *self, PyObject *args) -{ - long retval; - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - retval = isobj( arg1 ); - return mknewlongobject(retval); -} - -/* long isqueued short s */ - -static PyObject * -gl_isqueued(PyObject *self, PyObject *args) -{ - long retval; - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - retval = isqueued( arg1 ); - return mknewlongobject(retval); -} - -/* long istag long s */ - -static PyObject * -gl_istag(PyObject *self, PyObject *args) -{ - long retval; - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - retval = istag( arg1 ); - return mknewlongobject(retval); -} - -/* long genobj */ - -static PyObject * -gl_genobj(PyObject *self, PyObject *args) -{ - long retval; - retval = genobj( ); - return mknewlongobject(retval); -} - -/* long gentag */ - -static PyObject * -gl_gentag(PyObject *self, PyObject *args) -{ - long retval; - retval = gentag( ); - return mknewlongobject(retval); -} - -/* long getbuffer */ - -static PyObject * -gl_getbuffer(PyObject *self, PyObject *args) -{ - long retval; - retval = getbuffer( ); - return mknewlongobject(retval); -} - -/* long getcolor */ - -static PyObject * -gl_getcolor(PyObject *self, PyObject *args) -{ - long retval; - retval = getcolor( ); - return mknewlongobject(retval); -} - -/* long getdisplaymode */ - -static PyObject * -gl_getdisplaymode(PyObject *self, PyObject *args) -{ - long retval; - retval = getdisplaymode( ); - return mknewlongobject(retval); -} - -/* long getfont */ - -static PyObject * -gl_getfont(PyObject *self, PyObject *args) -{ - long retval; - retval = getfont( ); - return mknewlongobject(retval); -} - -/* long getheight */ - -static PyObject * -gl_getheight(PyObject *self, PyObject *args) -{ - long retval; - retval = getheight( ); - return mknewlongobject(retval); -} - -/* long gethitcode */ - -static PyObject * -gl_gethitcode(PyObject *self, PyObject *args) -{ - long retval; - retval = gethitcode( ); - return mknewlongobject(retval); -} - -/* long getlstyle */ - -static PyObject * -gl_getlstyle(PyObject *self, PyObject *args) -{ - long retval; - retval = getlstyle( ); - return mknewlongobject(retval); -} - -/* long getlwidth */ - -static PyObject * -gl_getlwidth(PyObject *self, PyObject *args) -{ - long retval; - retval = getlwidth( ); - return mknewlongobject(retval); -} - -/* long getmap */ - -static PyObject * -gl_getmap(PyObject *self, PyObject *args) -{ - long retval; - retval = getmap( ); - return mknewlongobject(retval); -} - -/* long getplanes */ - -static PyObject * -gl_getplanes(PyObject *self, PyObject *args) -{ - long retval; - retval = getplanes( ); - return mknewlongobject(retval); -} - -/* long getwritemask */ - -static PyObject * -gl_getwritemask(PyObject *self, PyObject *args) -{ - long retval; - retval = getwritemask( ); - return mknewlongobject(retval); -} - -/* long qtest */ - -static PyObject * -gl_qtest(PyObject *self, PyObject *args) -{ - long retval; - retval = qtest( ); - return mknewlongobject(retval); -} - -/* long getlsrepeat */ - -static PyObject * -gl_getlsrepeat(PyObject *self, PyObject *args) -{ - long retval; - retval = getlsrepeat( ); - return mknewlongobject(retval); -} - -/* long getmonitor */ - -static PyObject * -gl_getmonitor(PyObject *self, PyObject *args) -{ - long retval; - retval = getmonitor( ); - return mknewlongobject(retval); -} - -/* long getopenobj */ - -static PyObject * -gl_getopenobj(PyObject *self, PyObject *args) -{ - long retval; - retval = getopenobj( ); - return mknewlongobject(retval); -} - -/* long getpattern */ - -static PyObject * -gl_getpattern(PyObject *self, PyObject *args) -{ - long retval; - retval = getpattern( ); - return mknewlongobject(retval); -} - -/* long winget */ - -static PyObject * -gl_winget(PyObject *self, PyObject *args) -{ - long retval; - retval = winget( ); - return mknewlongobject(retval); -} - -/* long winattach */ - -static PyObject * -gl_winattach(PyObject *self, PyObject *args) -{ - long retval; - retval = winattach( ); - return mknewlongobject(retval); -} - -/* long getothermonitor */ - -static PyObject * -gl_getothermonitor(PyObject *self, PyObject *args) -{ - long retval; - retval = getothermonitor( ); - return mknewlongobject(retval); -} - -/* long newpup */ - -static PyObject * -gl_newpup(PyObject *self, PyObject *args) -{ - long retval; - retval = newpup( ); - return mknewlongobject(retval); -} - -/* long getvaluator short s */ - -static PyObject * -gl_getvaluator(PyObject *self, PyObject *args) -{ - long retval; - short arg1 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - retval = getvaluator( arg1 ); - return mknewlongobject(retval); -} - -/* void winset long s */ - -static PyObject * -gl_winset(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - winset( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long dopup long s */ - -static PyObject * -gl_dopup(PyObject *self, PyObject *args) -{ - long retval; - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - retval = dopup( arg1 ); - return mknewlongobject(retval); -} - -/* void getdepth short r short r */ - -static PyObject * -gl_getdepth(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - getdepth( & arg1 , & arg2 ); - { PyObject *v = PyTuple_New( 2 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject(arg2)); - return v; - } -} - -/* void getcpos short r short r */ - -static PyObject * -gl_getcpos(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - getcpos( & arg1 , & arg2 ); - { PyObject *v = PyTuple_New( 2 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject(arg2)); - return v; - } -} - -/* void getsize long r long r */ - -static PyObject * -gl_getsize(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - getsize( & arg1 , & arg2 ); - { PyObject *v = PyTuple_New( 2 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewlongobject(arg1)); - PyTuple_SetItem(v, 1, mknewlongobject(arg2)); - return v; - } -} - -/* void getorigin long r long r */ - -static PyObject * -gl_getorigin(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - getorigin( & arg1 , & arg2 ); - { PyObject *v = PyTuple_New( 2 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewlongobject(arg1)); - PyTuple_SetItem(v, 1, mknewlongobject(arg2)); - return v; - } -} - -/* void getviewport short r short r short r short r */ - -static PyObject * -gl_getviewport(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - getviewport( & arg1 , & arg2 , & arg3 , & arg4 ); - { PyObject *v = PyTuple_New( 4 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject(arg2)); - PyTuple_SetItem(v, 2, mknewshortobject(arg3)); - PyTuple_SetItem(v, 3, mknewshortobject(arg4)); - return v; - } -} - -/* void gettp short r short r short r short r */ - -static PyObject * -gl_gettp(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - gettp( & arg1 , & arg2 , & arg3 , & arg4 ); - { PyObject *v = PyTuple_New( 4 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject(arg2)); - PyTuple_SetItem(v, 2, mknewshortobject(arg3)); - PyTuple_SetItem(v, 3, mknewshortobject(arg4)); - return v; - } -} - -/* void getgpos float r float r float r float r */ - -static PyObject * -gl_getgpos(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - getgpos( & arg1 , & arg2 , & arg3 , & arg4 ); - { PyObject *v = PyTuple_New( 4 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewfloatobject(arg1)); - PyTuple_SetItem(v, 1, mknewfloatobject(arg2)); - PyTuple_SetItem(v, 2, mknewfloatobject(arg3)); - PyTuple_SetItem(v, 3, mknewfloatobject(arg4)); - return v; - } -} - -/* void winposition long s long s long s long s */ - -static PyObject * -gl_winposition(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - long arg4 ; - if (!getilongarg(args, 4, 0, &arg1)) - return NULL; - if (!getilongarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - winposition( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void gRGBcolor short r short r short r */ - -static PyObject * -gl_gRGBcolor(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - gRGBcolor( & arg1 , & arg2 , & arg3 ); - { PyObject *v = PyTuple_New( 3 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject(arg2)); - PyTuple_SetItem(v, 2, mknewshortobject(arg3)); - return v; - } -} - -/* void gRGBmask short r short r short r */ - -static PyObject * -gl_gRGBmask(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - gRGBmask( & arg1 , & arg2 , & arg3 ); - { PyObject *v = PyTuple_New( 3 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject(arg2)); - PyTuple_SetItem(v, 2, mknewshortobject(arg3)); - return v; - } -} - -/* void getscrmask short r short r short r short r */ - -static PyObject * -gl_getscrmask(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - getscrmask( & arg1 , & arg2 , & arg3 , & arg4 ); - { PyObject *v = PyTuple_New( 4 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject(arg2)); - PyTuple_SetItem(v, 2, mknewshortobject(arg3)); - PyTuple_SetItem(v, 3, mknewshortobject(arg4)); - return v; - } -} - -/* void getmcolor short s short r short r short r */ - -static PyObject * -gl_getmcolor(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 1, 0, &arg1)) - return NULL; - getmcolor( arg1 , & arg2 , & arg3 , & arg4 ); - { PyObject *v = PyTuple_New( 3 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg2)); - PyTuple_SetItem(v, 1, mknewshortobject(arg3)); - PyTuple_SetItem(v, 2, mknewshortobject(arg4)); - return v; - } -} - -/* void mapw long s short s short s float r float r float r float r float r float r */ - -static PyObject * -gl_mapw(PyObject *self, PyObject *args) -{ - long arg1 ; - short arg2 ; - short arg3 ; - float arg4 ; - float arg5 ; - float arg6 ; - float arg7 ; - float arg8 ; - float arg9 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - mapw( arg1 , arg2 , arg3 , & arg4 , & arg5 , & arg6 , & arg7 , & arg8 , & arg9 ); - { PyObject *v = PyTuple_New( 6 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewfloatobject(arg4)); - PyTuple_SetItem(v, 1, mknewfloatobject(arg5)); - PyTuple_SetItem(v, 2, mknewfloatobject(arg6)); - PyTuple_SetItem(v, 3, mknewfloatobject(arg7)); - PyTuple_SetItem(v, 4, mknewfloatobject(arg8)); - PyTuple_SetItem(v, 5, mknewfloatobject(arg9)); - return v; - } -} - -/* void mapw2 long s short s short s float r float r */ - -static PyObject * -gl_mapw2(PyObject *self, PyObject *args) -{ - long arg1 ; - short arg2 ; - short arg3 ; - float arg4 ; - float arg5 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getishortarg(args, 3, 1, &arg2)) - return NULL; - if (!getishortarg(args, 3, 2, &arg3)) - return NULL; - mapw2( arg1 , arg2 , arg3 , & arg4 , & arg5 ); - { PyObject *v = PyTuple_New( 2 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewfloatobject(arg4)); - PyTuple_SetItem(v, 1, mknewfloatobject(arg5)); - return v; - } -} - -/* void getcursor short r u_short r u_short r long r */ - -static PyObject * -gl_getcursor(PyObject *self, PyObject *args) -{ - short arg1 ; - unsigned short arg2 ; - unsigned short arg3 ; - long arg4 ; - getcursor( & arg1 , & arg2 , & arg3 , & arg4 ); - { PyObject *v = PyTuple_New( 4 ); - if (v == NULL) return NULL; - PyTuple_SetItem(v, 0, mknewshortobject(arg1)); - PyTuple_SetItem(v, 1, mknewshortobject((short) arg2)); - PyTuple_SetItem(v, 2, mknewshortobject((short) arg3)); - PyTuple_SetItem(v, 3, mknewlongobject(arg4)); - return v; - } -} - -/* void cmode */ - -static PyObject * -gl_cmode(PyObject *self, PyObject *args) -{ - cmode( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void concave long s */ - -static PyObject * -gl_concave(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - concave( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void curstype long s */ - -static PyObject * -gl_curstype(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - curstype( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void drawmode long s */ - -static PyObject * -gl_drawmode(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - drawmode( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void gammaramp short s[256] short s[256] short s[256] */ - -static PyObject * -gl_gammaramp(PyObject *self, PyObject *args) -{ - short arg1 [ 256 ] ; - short arg2 [ 256 ] ; - short arg3 [ 256 ] ; - if (!getishortarray(args, 3, 0, 256 , arg1)) - return NULL; - if (!getishortarray(args, 3, 1, 256 , arg2)) - return NULL; - if (!getishortarray(args, 3, 2, 256 , arg3)) - return NULL; - gammaramp( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long getbackface */ - -static PyObject * -gl_getbackface(PyObject *self, PyObject *args) -{ - long retval; - retval = getbackface( ); - return mknewlongobject(retval); -} - -/* long getdescender */ - -static PyObject * -gl_getdescender(PyObject *self, PyObject *args) -{ - long retval; - retval = getdescender( ); - return mknewlongobject(retval); -} - -/* long getdrawmode */ - -static PyObject * -gl_getdrawmode(PyObject *self, PyObject *args) -{ - long retval; - retval = getdrawmode( ); - return mknewlongobject(retval); -} - -/* long getmmode */ - -static PyObject * -gl_getmmode(PyObject *self, PyObject *args) -{ - long retval; - retval = getmmode( ); - return mknewlongobject(retval); -} - -/* long getsm */ - -static PyObject * -gl_getsm(PyObject *self, PyObject *args) -{ - long retval; - retval = getsm( ); - return mknewlongobject(retval); -} - -/* long getvideo long s */ - -static PyObject * -gl_getvideo(PyObject *self, PyObject *args) -{ - long retval; - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - retval = getvideo( arg1 ); - return mknewlongobject(retval); -} - -/* void imakebackground */ - -static PyObject * -gl_imakebackground(PyObject *self, PyObject *args) -{ - imakebackground( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lmbind short s short s */ - -static PyObject * -gl_lmbind(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - if (!getishortarg(args, 2, 0, &arg1)) - return NULL; - if (!getishortarg(args, 2, 1, &arg2)) - return NULL; - lmbind( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lmdef long s long s long s float s[arg3] */ - -static PyObject * -gl_lmdef(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - float * arg4 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarraysize(args, 3, 2, &arg3)) - return NULL; - if ((arg4 = PyMem_NEW(float , arg3 )) == NULL) - return PyErr_NoMemory(); - if (!getifloatarray(args, 3, 2, arg3 , arg4)) - return NULL; - lmdef( arg1 , arg2 , arg3 , arg4 ); - PyMem_DEL(arg4); - Py_INCREF(Py_None); - return Py_None; -} - -/* void mmode long s */ - -static PyObject * -gl_mmode(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - mmode( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void normal float s[3] */ - -static PyObject * -gl_normal(PyObject *self, PyObject *args) -{ - float arg1 [ 3 ] ; - if (!getifloatarray(args, 1, 0, 3 , arg1)) - return NULL; - normal( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void overlay long s */ - -static PyObject * -gl_overlay(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - overlay( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void RGBrange short s short s short s short s short s short s short s short s */ - -static PyObject * -gl_RGBrange(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - short arg6 ; - short arg7 ; - short arg8 ; - if (!getishortarg(args, 8, 0, &arg1)) - return NULL; - if (!getishortarg(args, 8, 1, &arg2)) - return NULL; - if (!getishortarg(args, 8, 2, &arg3)) - return NULL; - if (!getishortarg(args, 8, 3, &arg4)) - return NULL; - if (!getishortarg(args, 8, 4, &arg5)) - return NULL; - if (!getishortarg(args, 8, 5, &arg6)) - return NULL; - if (!getishortarg(args, 8, 6, &arg7)) - return NULL; - if (!getishortarg(args, 8, 7, &arg8)) - return NULL; - RGBrange( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setvideo long s long s */ - -static PyObject * -gl_setvideo(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - setvideo( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void shademodel long s */ - -static PyObject * -gl_shademodel(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - shademodel( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void underlay long s */ - -static PyObject * -gl_underlay(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - underlay( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bgnclosedline */ - -static PyObject * -gl_bgnclosedline(PyObject *self, PyObject *args) -{ - bgnclosedline( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bgnline */ - -static PyObject * -gl_bgnline(PyObject *self, PyObject *args) -{ - bgnline( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bgnpoint */ - -static PyObject * -gl_bgnpoint(PyObject *self, PyObject *args) -{ - bgnpoint( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bgnpolygon */ - -static PyObject * -gl_bgnpolygon(PyObject *self, PyObject *args) -{ - bgnpolygon( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bgnsurface */ - -static PyObject * -gl_bgnsurface(PyObject *self, PyObject *args) -{ - bgnsurface( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bgntmesh */ - -static PyObject * -gl_bgntmesh(PyObject *self, PyObject *args) -{ - bgntmesh( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void bgntrim */ - -static PyObject * -gl_bgntrim(PyObject *self, PyObject *args) -{ - bgntrim( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endclosedline */ - -static PyObject * -gl_endclosedline(PyObject *self, PyObject *args) -{ - endclosedline( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endline */ - -static PyObject * -gl_endline(PyObject *self, PyObject *args) -{ - endline( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endpoint */ - -static PyObject * -gl_endpoint(PyObject *self, PyObject *args) -{ - endpoint( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endpolygon */ - -static PyObject * -gl_endpolygon(PyObject *self, PyObject *args) -{ - endpolygon( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endsurface */ - -static PyObject * -gl_endsurface(PyObject *self, PyObject *args) -{ - endsurface( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endtmesh */ - -static PyObject * -gl_endtmesh(PyObject *self, PyObject *args) -{ - endtmesh( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void endtrim */ - -static PyObject * -gl_endtrim(PyObject *self, PyObject *args) -{ - endtrim( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void blendfunction long s long s */ - -static PyObject * -gl_blendfunction(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - blendfunction( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void c3f float s[3] */ - -static PyObject * -gl_c3f(PyObject *self, PyObject *args) -{ - float arg1 [ 3 ] ; - if (!getifloatarray(args, 1, 0, 3 , arg1)) - return NULL; - c3f( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void c3i long s[3] */ - -static PyObject * -gl_c3i(PyObject *self, PyObject *args) -{ - long arg1 [ 3 ] ; - if (!getilongarray(args, 1, 0, 3 , arg1)) - return NULL; - c3i( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void c3s short s[3] */ - -static PyObject * -gl_c3s(PyObject *self, PyObject *args) -{ - short arg1 [ 3 ] ; - if (!getishortarray(args, 1, 0, 3 , arg1)) - return NULL; - c3s( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void c4f float s[4] */ - -static PyObject * -gl_c4f(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] ; - if (!getifloatarray(args, 1, 0, 4 , arg1)) - return NULL; - c4f( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void c4i long s[4] */ - -static PyObject * -gl_c4i(PyObject *self, PyObject *args) -{ - long arg1 [ 4 ] ; - if (!getilongarray(args, 1, 0, 4 , arg1)) - return NULL; - c4i( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void c4s short s[4] */ - -static PyObject * -gl_c4s(PyObject *self, PyObject *args) -{ - short arg1 [ 4 ] ; - if (!getishortarray(args, 1, 0, 4 , arg1)) - return NULL; - c4s( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void colorf float s */ - -static PyObject * -gl_colorf(PyObject *self, PyObject *args) -{ - float arg1 ; - if (!getifloatarg(args, 1, 0, &arg1)) - return NULL; - colorf( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void cpack long s */ - -static PyObject * -gl_cpack(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - cpack( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void czclear long s long s */ - -static PyObject * -gl_czclear(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - czclear( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void dglclose long s */ - -static PyObject * -gl_dglclose(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - dglclose( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long dglopen char *s long s */ - -static PyObject * -gl_dglopen(PyObject *self, PyObject *args) -{ - long retval; - string arg1 ; - long arg2 ; - if (!getistringarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - retval = dglopen( arg1 , arg2 ); - return mknewlongobject(retval); -} - -/* long getgdesc long s */ - -static PyObject * -gl_getgdesc(PyObject *self, PyObject *args) -{ - long retval; - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - retval = getgdesc( arg1 ); - return mknewlongobject(retval); -} - -/* void getnurbsproperty long s float r */ - -static PyObject * -gl_getnurbsproperty(PyObject *self, PyObject *args) -{ - long arg1 ; - float arg2 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - getnurbsproperty( arg1 , & arg2 ); - return mknewfloatobject(arg2); -} - -/* void glcompat long s long s */ - -static PyObject * -gl_glcompat(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - glcompat( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void iconsize long s long s */ - -static PyObject * -gl_iconsize(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - iconsize( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void icontitle char *s */ - -static PyObject * -gl_icontitle(PyObject *self, PyObject *args) -{ - string arg1 ; - if (!getistringarg(args, 1, 0, &arg1)) - return NULL; - icontitle( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lRGBrange short s short s short s short s short s short s long s long s */ - -static PyObject * -gl_lRGBrange(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - short arg5 ; - short arg6 ; - long arg7 ; - long arg8 ; - if (!getishortarg(args, 8, 0, &arg1)) - return NULL; - if (!getishortarg(args, 8, 1, &arg2)) - return NULL; - if (!getishortarg(args, 8, 2, &arg3)) - return NULL; - if (!getishortarg(args, 8, 3, &arg4)) - return NULL; - if (!getishortarg(args, 8, 4, &arg5)) - return NULL; - if (!getishortarg(args, 8, 5, &arg6)) - return NULL; - if (!getilongarg(args, 8, 6, &arg7)) - return NULL; - if (!getilongarg(args, 8, 7, &arg8)) - return NULL; - lRGBrange( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void linesmooth long s */ - -static PyObject * -gl_linesmooth(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - linesmooth( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lmcolor long s */ - -static PyObject * -gl_lmcolor(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - lmcolor( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void logicop long s */ - -static PyObject * -gl_logicop(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - logicop( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lsetdepth long s long s */ - -static PyObject * -gl_lsetdepth(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - lsetdepth( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void lshaderange short s short s long s long s */ - -static PyObject * -gl_lshaderange(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - long arg3 ; - long arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - lshaderange( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void n3f float s[3] */ - -static PyObject * -gl_n3f(PyObject *self, PyObject *args) -{ - float arg1 [ 3 ] ; - if (!getifloatarray(args, 1, 0, 3 , arg1)) - return NULL; - n3f( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void noborder */ - -static PyObject * -gl_noborder(PyObject *self, PyObject *args) -{ - noborder( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pntsmooth long s */ - -static PyObject * -gl_pntsmooth(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - pntsmooth( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void readsource long s */ - -static PyObject * -gl_readsource(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - readsource( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void rectzoom float s float s */ - -static PyObject * -gl_rectzoom(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - if (!getifloatarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - rectzoom( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void sbox float s float s float s float s */ - -static PyObject * -gl_sbox(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - if (!getifloatarg(args, 4, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 4, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 4, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 4, 3, &arg4)) - return NULL; - sbox( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void sboxi long s long s long s long s */ - -static PyObject * -gl_sboxi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - long arg4 ; - if (!getilongarg(args, 4, 0, &arg1)) - return NULL; - if (!getilongarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - sboxi( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void sboxs short s short s short s short s */ - -static PyObject * -gl_sboxs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - sboxs( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void sboxf float s float s float s float s */ - -static PyObject * -gl_sboxf(PyObject *self, PyObject *args) -{ - float arg1 ; - float arg2 ; - float arg3 ; - float arg4 ; - if (!getifloatarg(args, 4, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 4, 1, &arg2)) - return NULL; - if (!getifloatarg(args, 4, 2, &arg3)) - return NULL; - if (!getifloatarg(args, 4, 3, &arg4)) - return NULL; - sboxf( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void sboxfi long s long s long s long s */ - -static PyObject * -gl_sboxfi(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - long arg4 ; - if (!getilongarg(args, 4, 0, &arg1)) - return NULL; - if (!getilongarg(args, 4, 1, &arg2)) - return NULL; - if (!getilongarg(args, 4, 2, &arg3)) - return NULL; - if (!getilongarg(args, 4, 3, &arg4)) - return NULL; - sboxfi( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void sboxfs short s short s short s short s */ - -static PyObject * -gl_sboxfs(PyObject *self, PyObject *args) -{ - short arg1 ; - short arg2 ; - short arg3 ; - short arg4 ; - if (!getishortarg(args, 4, 0, &arg1)) - return NULL; - if (!getishortarg(args, 4, 1, &arg2)) - return NULL; - if (!getishortarg(args, 4, 2, &arg3)) - return NULL; - if (!getishortarg(args, 4, 3, &arg4)) - return NULL; - sboxfs( arg1 , arg2 , arg3 , arg4 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setnurbsproperty long s float s */ - -static PyObject * -gl_setnurbsproperty(PyObject *self, PyObject *args) -{ - long arg1 ; - float arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getifloatarg(args, 2, 1, &arg2)) - return NULL; - setnurbsproperty( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void setpup long s long s long s */ - -static PyObject * -gl_setpup(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - long arg3 ; - if (!getilongarg(args, 3, 0, &arg1)) - return NULL; - if (!getilongarg(args, 3, 1, &arg2)) - return NULL; - if (!getilongarg(args, 3, 2, &arg3)) - return NULL; - setpup( arg1 , arg2 , arg3 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void smoothline long s */ - -static PyObject * -gl_smoothline(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - smoothline( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void subpixel long s */ - -static PyObject * -gl_subpixel(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - subpixel( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void swaptmesh */ - -static PyObject * -gl_swaptmesh(PyObject *self, PyObject *args) -{ - swaptmesh( ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long swinopen long s */ - -static PyObject * -gl_swinopen(PyObject *self, PyObject *args) -{ - long retval; - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - retval = swinopen( arg1 ); - return mknewlongobject(retval); -} - -/* void v2f float s[2] */ - -static PyObject * -gl_v2f(PyObject *self, PyObject *args) -{ - float arg1 [ 2 ] ; - if (!getifloatarray(args, 1, 0, 2 , arg1)) - return NULL; - v2f( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v2i long s[2] */ - -static PyObject * -gl_v2i(PyObject *self, PyObject *args) -{ - long arg1 [ 2 ] ; - if (!getilongarray(args, 1, 0, 2 , arg1)) - return NULL; - v2i( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v2s short s[2] */ - -static PyObject * -gl_v2s(PyObject *self, PyObject *args) -{ - short arg1 [ 2 ] ; - if (!getishortarray(args, 1, 0, 2 , arg1)) - return NULL; - v2s( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v3f float s[3] */ - -static PyObject * -gl_v3f(PyObject *self, PyObject *args) -{ - float arg1 [ 3 ] ; - if (!getifloatarray(args, 1, 0, 3 , arg1)) - return NULL; - v3f( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v3i long s[3] */ - -static PyObject * -gl_v3i(PyObject *self, PyObject *args) -{ - long arg1 [ 3 ] ; - if (!getilongarray(args, 1, 0, 3 , arg1)) - return NULL; - v3i( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v3s short s[3] */ - -static PyObject * -gl_v3s(PyObject *self, PyObject *args) -{ - short arg1 [ 3 ] ; - if (!getishortarray(args, 1, 0, 3 , arg1)) - return NULL; - v3s( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v4f float s[4] */ - -static PyObject * -gl_v4f(PyObject *self, PyObject *args) -{ - float arg1 [ 4 ] ; - if (!getifloatarray(args, 1, 0, 4 , arg1)) - return NULL; - v4f( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v4i long s[4] */ - -static PyObject * -gl_v4i(PyObject *self, PyObject *args) -{ - long arg1 [ 4 ] ; - if (!getilongarray(args, 1, 0, 4 , arg1)) - return NULL; - v4i( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v4s short s[4] */ - -static PyObject * -gl_v4s(PyObject *self, PyObject *args) -{ - short arg1 [ 4 ] ; - if (!getishortarray(args, 1, 0, 4 , arg1)) - return NULL; - v4s( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void videocmd long s */ - -static PyObject * -gl_videocmd(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - videocmd( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long windepth long s */ - -static PyObject * -gl_windepth(PyObject *self, PyObject *args) -{ - long retval; - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - retval = windepth( arg1 ); - return mknewlongobject(retval); -} - -/* void wmpack long s */ - -static PyObject * -gl_wmpack(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - wmpack( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void zdraw long s */ - -static PyObject * -gl_zdraw(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - zdraw( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void zfunction long s */ - -static PyObject * -gl_zfunction(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - zfunction( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void zsource long s */ - -static PyObject * -gl_zsource(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - zsource( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void zwritemask long s */ - -static PyObject * -gl_zwritemask(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - zwritemask( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v2d double s[2] */ - -static PyObject * -gl_v2d(PyObject *self, PyObject *args) -{ - double arg1 [ 2 ] ; - if (!getidoublearray(args, 1, 0, 2 , arg1)) - return NULL; - v2d( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v3d double s[3] */ - -static PyObject * -gl_v3d(PyObject *self, PyObject *args) -{ - double arg1 [ 3 ] ; - if (!getidoublearray(args, 1, 0, 3 , arg1)) - return NULL; - v3d( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void v4d double s[4] */ - -static PyObject * -gl_v4d(PyObject *self, PyObject *args) -{ - double arg1 [ 4 ] ; - if (!getidoublearray(args, 1, 0, 4 , arg1)) - return NULL; - v4d( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* void pixmode long s long s */ - -static PyObject * -gl_pixmode(PyObject *self, PyObject *args) -{ - long arg1 ; - long arg2 ; - if (!getilongarg(args, 2, 0, &arg1)) - return NULL; - if (!getilongarg(args, 2, 1, &arg2)) - return NULL; - pixmode( arg1 , arg2 ); - Py_INCREF(Py_None); - return Py_None; -} - -/* long qgetfd */ - -static PyObject * -gl_qgetfd(PyObject *self, PyObject *args) -{ - long retval; - retval = qgetfd( ); - return mknewlongobject(retval); -} - -/* void dither long s */ - -static PyObject * -gl_dither(PyObject *self, PyObject *args) -{ - long arg1 ; - if (!getilongarg(args, 1, 0, &arg1)) - return NULL; - dither( arg1 ); - Py_INCREF(Py_None); - return Py_None; -} - -static struct PyMethodDef gl_methods[] = { - {"qread", gl_qread, METH_OLDARGS}, - {"varray", gl_varray, METH_OLDARGS}, - {"nvarray", gl_nvarray, METH_OLDARGS}, - {"vnarray", gl_vnarray, METH_OLDARGS}, - {"nurbssurface", gl_nurbssurface, METH_OLDARGS}, - {"nurbscurve", gl_nurbscurve, METH_OLDARGS}, - {"pwlcurve", gl_pwlcurve, METH_OLDARGS}, - {"pick", gl_pick, METH_OLDARGS}, - {"endpick", gl_endpick, METH_NOARGS}, - {"gselect", gl_gselect, METH_OLDARGS}, - {"endselect", gl_endselect, METH_NOARGS}, - {"getmatrix", gl_getmatrix, METH_OLDARGS}, - {"altgetmatrix", gl_altgetmatrix, METH_OLDARGS}, - {"lrectwrite", gl_lrectwrite, METH_OLDARGS}, - {"lrectread", gl_lrectread, METH_OLDARGS}, - {"readdisplay", gl_readdisplay, METH_OLDARGS}, - {"packrect", gl_packrect, METH_OLDARGS}, - {"unpackrect", gl_unpackrect, METH_OLDARGS}, - {"gversion", gl_gversion, METH_OLDARGS}, - {"clear", gl_clear, METH_OLDARGS}, - {"getshade", gl_getshade, METH_OLDARGS}, - {"devport", gl_devport, METH_OLDARGS}, - {"rdr2i", gl_rdr2i, METH_OLDARGS}, - {"rectfs", gl_rectfs, METH_OLDARGS}, - {"rects", gl_rects, METH_OLDARGS}, - {"rmv2i", gl_rmv2i, METH_OLDARGS}, - {"noport", gl_noport, METH_OLDARGS}, - {"popviewport", gl_popviewport, METH_OLDARGS}, - {"clearhitcode", gl_clearhitcode, METH_OLDARGS}, - {"closeobj", gl_closeobj, METH_OLDARGS}, - {"cursoff", gl_cursoff, METH_OLDARGS}, - {"curson", gl_curson, METH_OLDARGS}, - {"doublebuffer", gl_doublebuffer, METH_OLDARGS}, - {"finish", gl_finish, METH_OLDARGS}, - {"gconfig", gl_gconfig, METH_OLDARGS}, - {"ginit", gl_ginit, METH_OLDARGS}, - {"greset", gl_greset, METH_OLDARGS}, - {"multimap", gl_multimap, METH_OLDARGS}, - {"onemap", gl_onemap, METH_OLDARGS}, - {"popattributes", gl_popattributes, METH_OLDARGS}, - {"popmatrix", gl_popmatrix, METH_OLDARGS}, - {"pushattributes", gl_pushattributes,METH_OLDARGS}, - {"pushmatrix", gl_pushmatrix, METH_OLDARGS}, - {"pushviewport", gl_pushviewport, METH_OLDARGS}, - {"qreset", gl_qreset, METH_OLDARGS}, - {"RGBmode", gl_RGBmode, METH_OLDARGS}, - {"singlebuffer", gl_singlebuffer, METH_OLDARGS}, - {"swapbuffers", gl_swapbuffers, METH_OLDARGS}, - {"gsync", gl_gsync, METH_OLDARGS}, - {"gflush", gl_gflush, METH_OLDARGS}, - {"tpon", gl_tpon, METH_OLDARGS}, - {"tpoff", gl_tpoff, METH_OLDARGS}, - {"clkon", gl_clkon, METH_OLDARGS}, - {"clkoff", gl_clkoff, METH_OLDARGS}, - {"ringbell", gl_ringbell, METH_OLDARGS}, - {"gbegin", gl_gbegin, METH_OLDARGS}, - {"textinit", gl_textinit, METH_OLDARGS}, - {"initnames", gl_initnames, METH_OLDARGS}, - {"pclos", gl_pclos, METH_OLDARGS}, - {"popname", gl_popname, METH_OLDARGS}, - {"spclos", gl_spclos, METH_OLDARGS}, - {"zclear", gl_zclear, METH_OLDARGS}, - {"screenspace", gl_screenspace, METH_OLDARGS}, - {"reshapeviewport", gl_reshapeviewport, METH_OLDARGS}, - {"winpush", gl_winpush, METH_OLDARGS}, - {"winpop", gl_winpop, METH_OLDARGS}, - {"foreground", gl_foreground, METH_OLDARGS}, - {"endfullscrn", gl_endfullscrn, METH_OLDARGS}, - {"endpupmode", gl_endpupmode, METH_OLDARGS}, - {"fullscrn", gl_fullscrn, METH_OLDARGS}, - {"pupmode", gl_pupmode, METH_OLDARGS}, - {"winconstraints", gl_winconstraints, METH_OLDARGS}, - {"pagecolor", gl_pagecolor, METH_OLDARGS}, - {"textcolor", gl_textcolor, METH_OLDARGS}, - {"color", gl_color, METH_OLDARGS}, - {"curveit", gl_curveit, METH_OLDARGS}, - {"font", gl_font, METH_OLDARGS}, - {"linewidth", gl_linewidth, METH_OLDARGS}, - {"setlinestyle", gl_setlinestyle, METH_OLDARGS}, - {"setmap", gl_setmap, METH_OLDARGS}, - {"swapinterval", gl_swapinterval, METH_OLDARGS}, - {"writemask", gl_writemask, METH_OLDARGS}, - {"textwritemask", gl_textwritemask, METH_OLDARGS}, - {"qdevice", gl_qdevice, METH_OLDARGS}, - {"unqdevice", gl_unqdevice, METH_OLDARGS}, - {"curvebasis", gl_curvebasis, METH_OLDARGS}, - {"curveprecision", gl_curveprecision,METH_OLDARGS}, - {"loadname", gl_loadname, METH_OLDARGS}, - {"passthrough", gl_passthrough, METH_OLDARGS}, - {"pushname", gl_pushname, METH_OLDARGS}, - {"setmonitor", gl_setmonitor, METH_OLDARGS}, - {"setshade", gl_setshade, METH_OLDARGS}, - {"setpattern", gl_setpattern, METH_OLDARGS}, - {"pagewritemask", gl_pagewritemask, METH_OLDARGS}, - {"callobj", gl_callobj, METH_OLDARGS}, - {"delobj", gl_delobj, METH_OLDARGS}, - {"editobj", gl_editobj, METH_OLDARGS}, - {"makeobj", gl_makeobj, METH_OLDARGS}, - {"maketag", gl_maketag, METH_OLDARGS}, - {"chunksize", gl_chunksize, METH_OLDARGS}, - {"compactify", gl_compactify, METH_OLDARGS}, - {"deltag", gl_deltag, METH_OLDARGS}, - {"lsrepeat", gl_lsrepeat, METH_OLDARGS}, - {"objinsert", gl_objinsert, METH_OLDARGS}, - {"objreplace", gl_objreplace, METH_OLDARGS}, - {"winclose", gl_winclose, METH_OLDARGS}, - {"blanktime", gl_blanktime, METH_OLDARGS}, - {"freepup", gl_freepup, METH_OLDARGS}, - {"backbuffer", gl_backbuffer, METH_OLDARGS}, - {"frontbuffer", gl_frontbuffer, METH_OLDARGS}, - {"lsbackup", gl_lsbackup, METH_OLDARGS}, - {"resetls", gl_resetls, METH_OLDARGS}, - {"lampon", gl_lampon, METH_OLDARGS}, - {"lampoff", gl_lampoff, METH_OLDARGS}, - {"setbell", gl_setbell, METH_OLDARGS}, - {"blankscreen", gl_blankscreen, METH_OLDARGS}, - {"depthcue", gl_depthcue, METH_OLDARGS}, - {"zbuffer", gl_zbuffer, METH_OLDARGS}, - {"backface", gl_backface, METH_OLDARGS}, - {"cmov2i", gl_cmov2i, METH_OLDARGS}, - {"draw2i", gl_draw2i, METH_OLDARGS}, - {"move2i", gl_move2i, METH_OLDARGS}, - {"pnt2i", gl_pnt2i, METH_OLDARGS}, - {"patchbasis", gl_patchbasis, METH_OLDARGS}, - {"patchprecision", gl_patchprecision, METH_OLDARGS}, - {"pdr2i", gl_pdr2i, METH_OLDARGS}, - {"pmv2i", gl_pmv2i, METH_OLDARGS}, - {"rpdr2i", gl_rpdr2i, METH_OLDARGS}, - {"rpmv2i", gl_rpmv2i, METH_OLDARGS}, - {"xfpt2i", gl_xfpt2i, METH_OLDARGS}, - {"objdelete", gl_objdelete, METH_OLDARGS}, - {"patchcurves", gl_patchcurves, METH_OLDARGS}, - {"minsize", gl_minsize, METH_OLDARGS}, - {"maxsize", gl_maxsize, METH_OLDARGS}, - {"keepaspect", gl_keepaspect, METH_OLDARGS}, - {"prefsize", gl_prefsize, METH_OLDARGS}, - {"stepunit", gl_stepunit, METH_OLDARGS}, - {"fudge", gl_fudge, METH_OLDARGS}, - {"winmove", gl_winmove, METH_OLDARGS}, - {"attachcursor", gl_attachcursor, METH_OLDARGS}, - {"deflinestyle", gl_deflinestyle, METH_OLDARGS}, - {"noise", gl_noise, METH_OLDARGS}, - {"picksize", gl_picksize, METH_OLDARGS}, - {"qenter", gl_qenter, METH_OLDARGS}, - {"setdepth", gl_setdepth, METH_OLDARGS}, - {"cmov2s", gl_cmov2s, METH_OLDARGS}, - {"draw2s", gl_draw2s, METH_OLDARGS}, - {"move2s", gl_move2s, METH_OLDARGS}, - {"pdr2s", gl_pdr2s, METH_OLDARGS}, - {"pmv2s", gl_pmv2s, METH_OLDARGS}, - {"pnt2s", gl_pnt2s, METH_OLDARGS}, - {"rdr2s", gl_rdr2s, METH_OLDARGS}, - {"rmv2s", gl_rmv2s, METH_OLDARGS}, - {"rpdr2s", gl_rpdr2s, METH_OLDARGS}, - {"rpmv2s", gl_rpmv2s, METH_OLDARGS}, - {"xfpt2s", gl_xfpt2s, METH_OLDARGS}, - {"cmov2", gl_cmov2, METH_OLDARGS}, - {"draw2", gl_draw2, METH_OLDARGS}, - {"move2", gl_move2, METH_OLDARGS}, - {"pnt2", gl_pnt2, METH_OLDARGS}, - {"pdr2", gl_pdr2, METH_OLDARGS}, - {"pmv2", gl_pmv2, METH_OLDARGS}, - {"rdr2", gl_rdr2, METH_OLDARGS}, - {"rmv2", gl_rmv2, METH_OLDARGS}, - {"rpdr2", gl_rpdr2, METH_OLDARGS}, - {"rpmv2", gl_rpmv2, METH_OLDARGS}, - {"xfpt2", gl_xfpt2, METH_OLDARGS}, - {"loadmatrix", gl_loadmatrix, METH_OLDARGS}, - {"multmatrix", gl_multmatrix, METH_OLDARGS}, - {"crv", gl_crv, METH_OLDARGS}, - {"rcrv", gl_rcrv, METH_OLDARGS}, - {"addtopup", gl_addtopup, METH_OLDARGS}, - {"charstr", gl_charstr, METH_OLDARGS}, - {"getport", gl_getport, METH_OLDARGS}, - {"strwidth", gl_strwidth, METH_OLDARGS}, - {"winopen", gl_winopen, METH_OLDARGS}, - {"wintitle", gl_wintitle, METH_OLDARGS}, - {"polf", gl_polf, METH_OLDARGS}, - {"polf2", gl_polf2, METH_OLDARGS}, - {"poly", gl_poly, METH_OLDARGS}, - {"poly2", gl_poly2, METH_OLDARGS}, - {"crvn", gl_crvn, METH_OLDARGS}, - {"rcrvn", gl_rcrvn, METH_OLDARGS}, - {"polf2i", gl_polf2i, METH_OLDARGS}, - {"polfi", gl_polfi, METH_OLDARGS}, - {"poly2i", gl_poly2i, METH_OLDARGS}, - {"polyi", gl_polyi, METH_OLDARGS}, - {"polf2s", gl_polf2s, METH_OLDARGS}, - {"polfs", gl_polfs, METH_OLDARGS}, - {"polys", gl_polys, METH_OLDARGS}, - {"poly2s", gl_poly2s, METH_OLDARGS}, - {"defcursor", gl_defcursor, METH_OLDARGS}, - {"writepixels", gl_writepixels, METH_OLDARGS}, - {"defbasis", gl_defbasis, METH_OLDARGS}, - {"gewrite", gl_gewrite, METH_OLDARGS}, - {"rotate", gl_rotate, METH_OLDARGS}, - {"rot", gl_rot, METH_OLDARGS}, - {"circfi", gl_circfi, METH_OLDARGS}, - {"circi", gl_circi, METH_OLDARGS}, - {"cmovi", gl_cmovi, METH_OLDARGS}, - {"drawi", gl_drawi, METH_OLDARGS}, - {"movei", gl_movei, METH_OLDARGS}, - {"pnti", gl_pnti, METH_OLDARGS}, - {"newtag", gl_newtag, METH_OLDARGS}, - {"pdri", gl_pdri, METH_OLDARGS}, - {"pmvi", gl_pmvi, METH_OLDARGS}, - {"rdri", gl_rdri, METH_OLDARGS}, - {"rmvi", gl_rmvi, METH_OLDARGS}, - {"rpdri", gl_rpdri, METH_OLDARGS}, - {"rpmvi", gl_rpmvi, METH_OLDARGS}, - {"xfpti", gl_xfpti, METH_OLDARGS}, - {"circ", gl_circ, METH_OLDARGS}, - {"circf", gl_circf, METH_OLDARGS}, - {"cmov", gl_cmov, METH_OLDARGS}, - {"draw", gl_draw, METH_OLDARGS}, - {"move", gl_move, METH_OLDARGS}, - {"pnt", gl_pnt, METH_OLDARGS}, - {"scale", gl_scale, METH_OLDARGS}, - {"translate", gl_translate, METH_OLDARGS}, - {"pdr", gl_pdr, METH_OLDARGS}, - {"pmv", gl_pmv, METH_OLDARGS}, - {"rdr", gl_rdr, METH_OLDARGS}, - {"rmv", gl_rmv, METH_OLDARGS}, - {"rpdr", gl_rpdr, METH_OLDARGS}, - {"rpmv", gl_rpmv, METH_OLDARGS}, - {"xfpt", gl_xfpt, METH_OLDARGS}, - {"RGBcolor", gl_RGBcolor, METH_OLDARGS}, - {"RGBwritemask", gl_RGBwritemask, METH_OLDARGS}, - {"setcursor", gl_setcursor, METH_OLDARGS}, - {"tie", gl_tie, METH_OLDARGS}, - {"circfs", gl_circfs, METH_OLDARGS}, - {"circs", gl_circs, METH_OLDARGS}, - {"cmovs", gl_cmovs, METH_OLDARGS}, - {"draws", gl_draws, METH_OLDARGS}, - {"moves", gl_moves, METH_OLDARGS}, - {"pdrs", gl_pdrs, METH_OLDARGS}, - {"pmvs", gl_pmvs, METH_OLDARGS}, - {"pnts", gl_pnts, METH_OLDARGS}, - {"rdrs", gl_rdrs, METH_OLDARGS}, - {"rmvs", gl_rmvs, METH_OLDARGS}, - {"rpdrs", gl_rpdrs, METH_OLDARGS}, - {"rpmvs", gl_rpmvs, METH_OLDARGS}, - {"xfpts", gl_xfpts, METH_OLDARGS}, - {"curorigin", gl_curorigin, METH_OLDARGS}, - {"cyclemap", gl_cyclemap, METH_OLDARGS}, - {"patch", gl_patch, METH_OLDARGS}, - {"splf", gl_splf, METH_OLDARGS}, - {"splf2", gl_splf2, METH_OLDARGS}, - {"splfi", gl_splfi, METH_OLDARGS}, - {"splf2i", gl_splf2i, METH_OLDARGS}, - {"splfs", gl_splfs, METH_OLDARGS}, - {"splf2s", gl_splf2s, METH_OLDARGS}, - {"rpatch", gl_rpatch, METH_OLDARGS}, - {"ortho2", gl_ortho2, METH_OLDARGS}, - {"rect", gl_rect, METH_OLDARGS}, - {"rectf", gl_rectf, METH_OLDARGS}, - {"xfpt4", gl_xfpt4, METH_OLDARGS}, - {"textport", gl_textport, METH_OLDARGS}, - {"mapcolor", gl_mapcolor, METH_OLDARGS}, - {"scrmask", gl_scrmask, METH_OLDARGS}, - {"setvaluator", gl_setvaluator, METH_OLDARGS}, - {"viewport", gl_viewport, METH_OLDARGS}, - {"shaderange", gl_shaderange, METH_OLDARGS}, - {"xfpt4s", gl_xfpt4s, METH_OLDARGS}, - {"rectfi", gl_rectfi, METH_OLDARGS}, - {"recti", gl_recti, METH_OLDARGS}, - {"xfpt4i", gl_xfpt4i, METH_OLDARGS}, - {"prefposition", gl_prefposition, METH_OLDARGS}, - {"arc", gl_arc, METH_OLDARGS}, - {"arcf", gl_arcf, METH_OLDARGS}, - {"arcfi", gl_arcfi, METH_OLDARGS}, - {"arci", gl_arci, METH_OLDARGS}, - {"bbox2", gl_bbox2, METH_OLDARGS}, - {"bbox2i", gl_bbox2i, METH_OLDARGS}, - {"bbox2s", gl_bbox2s, METH_OLDARGS}, - {"blink", gl_blink, METH_OLDARGS}, - {"ortho", gl_ortho, METH_OLDARGS}, - {"window", gl_window, METH_OLDARGS}, - {"lookat", gl_lookat, METH_OLDARGS}, - {"perspective", gl_perspective, METH_OLDARGS}, - {"polarview", gl_polarview, METH_OLDARGS}, - {"arcfs", gl_arcfs, METH_OLDARGS}, - {"arcs", gl_arcs, METH_OLDARGS}, - {"rectcopy", gl_rectcopy, METH_OLDARGS}, - {"RGBcursor", gl_RGBcursor, METH_OLDARGS}, - {"getbutton", gl_getbutton, METH_OLDARGS}, - {"getcmmode", gl_getcmmode, METH_OLDARGS}, - {"getlsbackup", gl_getlsbackup, METH_OLDARGS}, - {"getresetls", gl_getresetls, METH_OLDARGS}, - {"getdcm", gl_getdcm, METH_OLDARGS}, - {"getzbuffer", gl_getzbuffer, METH_OLDARGS}, - {"ismex", gl_ismex, METH_OLDARGS}, - {"isobj", gl_isobj, METH_OLDARGS}, - {"isqueued", gl_isqueued, METH_OLDARGS}, - {"istag", gl_istag, METH_OLDARGS}, - {"genobj", gl_genobj, METH_OLDARGS}, - {"gentag", gl_gentag, METH_OLDARGS}, - {"getbuffer", gl_getbuffer, METH_OLDARGS}, - {"getcolor", gl_getcolor, METH_OLDARGS}, - {"getdisplaymode", gl_getdisplaymode, METH_OLDARGS}, - {"getfont", gl_getfont, METH_OLDARGS}, - {"getheight", gl_getheight, METH_OLDARGS}, - {"gethitcode", gl_gethitcode, METH_OLDARGS}, - {"getlstyle", gl_getlstyle, METH_OLDARGS}, - {"getlwidth", gl_getlwidth, METH_OLDARGS}, - {"getmap", gl_getmap, METH_OLDARGS}, - {"getplanes", gl_getplanes, METH_OLDARGS}, - {"getwritemask", gl_getwritemask, METH_OLDARGS}, - {"qtest", gl_qtest, METH_OLDARGS}, - {"getlsrepeat", gl_getlsrepeat, METH_OLDARGS}, - {"getmonitor", gl_getmonitor, METH_OLDARGS}, - {"getopenobj", gl_getopenobj, METH_OLDARGS}, - {"getpattern", gl_getpattern, METH_OLDARGS}, - {"winget", gl_winget, METH_OLDARGS}, - {"winattach", gl_winattach, METH_OLDARGS}, - {"getothermonitor", gl_getothermonitor, METH_OLDARGS}, - {"newpup", gl_newpup, METH_OLDARGS}, - {"getvaluator", gl_getvaluator, METH_OLDARGS}, - {"winset", gl_winset, METH_OLDARGS}, - {"dopup", gl_dopup, METH_OLDARGS}, - {"getdepth", gl_getdepth, METH_OLDARGS}, - {"getcpos", gl_getcpos, METH_OLDARGS}, - {"getsize", gl_getsize, METH_OLDARGS}, - {"getorigin", gl_getorigin, METH_OLDARGS}, - {"getviewport", gl_getviewport, METH_OLDARGS}, - {"gettp", gl_gettp, METH_OLDARGS}, - {"getgpos", gl_getgpos, METH_OLDARGS}, - {"winposition", gl_winposition, METH_OLDARGS}, - {"gRGBcolor", gl_gRGBcolor, METH_OLDARGS}, - {"gRGBmask", gl_gRGBmask, METH_OLDARGS}, - {"getscrmask", gl_getscrmask, METH_OLDARGS}, - {"getmcolor", gl_getmcolor, METH_OLDARGS}, - {"mapw", gl_mapw, METH_OLDARGS}, - {"mapw2", gl_mapw2, METH_OLDARGS}, - {"getcursor", gl_getcursor, METH_OLDARGS}, - {"cmode", gl_cmode, METH_OLDARGS}, - {"concave", gl_concave, METH_OLDARGS}, - {"curstype", gl_curstype, METH_OLDARGS}, - {"drawmode", gl_drawmode, METH_OLDARGS}, - {"gammaramp", gl_gammaramp, METH_OLDARGS}, - {"getbackface", gl_getbackface, METH_OLDARGS}, - {"getdescender", gl_getdescender, METH_OLDARGS}, - {"getdrawmode", gl_getdrawmode, METH_OLDARGS}, - {"getmmode", gl_getmmode, METH_OLDARGS}, - {"getsm", gl_getsm, METH_OLDARGS}, - {"getvideo", gl_getvideo, METH_OLDARGS}, - {"imakebackground", gl_imakebackground, METH_OLDARGS}, - {"lmbind", gl_lmbind, METH_OLDARGS}, - {"lmdef", gl_lmdef, METH_OLDARGS}, - {"mmode", gl_mmode, METH_OLDARGS}, - {"normal", gl_normal, METH_OLDARGS}, - {"overlay", gl_overlay, METH_OLDARGS}, - {"RGBrange", gl_RGBrange, METH_OLDARGS}, - {"setvideo", gl_setvideo, METH_OLDARGS}, - {"shademodel", gl_shademodel, METH_OLDARGS}, - {"underlay", gl_underlay, METH_OLDARGS}, - {"bgnclosedline", gl_bgnclosedline, METH_OLDARGS}, - {"bgnline", gl_bgnline, METH_OLDARGS}, - {"bgnpoint", gl_bgnpoint, METH_OLDARGS}, - {"bgnpolygon", gl_bgnpolygon, METH_OLDARGS}, - {"bgnsurface", gl_bgnsurface, METH_OLDARGS}, - {"bgntmesh", gl_bgntmesh, METH_OLDARGS}, - {"bgntrim", gl_bgntrim, METH_OLDARGS}, - {"endclosedline", gl_endclosedline, METH_OLDARGS}, - {"endline", gl_endline, METH_OLDARGS}, - {"endpoint", gl_endpoint, METH_OLDARGS}, - {"endpolygon", gl_endpolygon, METH_OLDARGS}, - {"endsurface", gl_endsurface, METH_OLDARGS}, - {"endtmesh", gl_endtmesh, METH_OLDARGS}, - {"endtrim", gl_endtrim, METH_OLDARGS}, - {"blendfunction", gl_blendfunction, METH_OLDARGS}, - {"c3f", gl_c3f, METH_OLDARGS}, - {"c3i", gl_c3i, METH_OLDARGS}, - {"c3s", gl_c3s, METH_OLDARGS}, - {"c4f", gl_c4f, METH_OLDARGS}, - {"c4i", gl_c4i, METH_OLDARGS}, - {"c4s", gl_c4s, METH_OLDARGS}, - {"colorf", gl_colorf, METH_OLDARGS}, - {"cpack", gl_cpack, METH_OLDARGS}, - {"czclear", gl_czclear, METH_OLDARGS}, - {"dglclose", gl_dglclose, METH_OLDARGS}, - {"dglopen", gl_dglopen, METH_OLDARGS}, - {"getgdesc", gl_getgdesc, METH_OLDARGS}, - {"getnurbsproperty", gl_getnurbsproperty, METH_OLDARGS}, - {"glcompat", gl_glcompat, METH_OLDARGS}, - {"iconsize", gl_iconsize, METH_OLDARGS}, - {"icontitle", gl_icontitle, METH_OLDARGS}, - {"lRGBrange", gl_lRGBrange, METH_OLDARGS}, - {"linesmooth", gl_linesmooth, METH_OLDARGS}, - {"lmcolor", gl_lmcolor, METH_OLDARGS}, - {"logicop", gl_logicop, METH_OLDARGS}, - {"lsetdepth", gl_lsetdepth, METH_OLDARGS}, - {"lshaderange", gl_lshaderange, METH_OLDARGS}, - {"n3f", gl_n3f, METH_OLDARGS}, - {"noborder", gl_noborder, METH_OLDARGS}, - {"pntsmooth", gl_pntsmooth, METH_OLDARGS}, - {"readsource", gl_readsource, METH_OLDARGS}, - {"rectzoom", gl_rectzoom, METH_OLDARGS}, - {"sbox", gl_sbox, METH_OLDARGS}, - {"sboxi", gl_sboxi, METH_OLDARGS}, - {"sboxs", gl_sboxs, METH_OLDARGS}, - {"sboxf", gl_sboxf, METH_OLDARGS}, - {"sboxfi", gl_sboxfi, METH_OLDARGS}, - {"sboxfs", gl_sboxfs, METH_OLDARGS}, - {"setnurbsproperty", gl_setnurbsproperty, METH_OLDARGS}, - {"setpup", gl_setpup, METH_OLDARGS}, - {"smoothline", gl_smoothline, METH_OLDARGS}, - {"subpixel", gl_subpixel, METH_OLDARGS}, - {"swaptmesh", gl_swaptmesh, METH_OLDARGS}, - {"swinopen", gl_swinopen, METH_OLDARGS}, - {"v2f", gl_v2f, METH_OLDARGS}, - {"v2i", gl_v2i, METH_OLDARGS}, - {"v2s", gl_v2s, METH_OLDARGS}, - {"v3f", gl_v3f, METH_OLDARGS}, - {"v3i", gl_v3i, METH_OLDARGS}, - {"v3s", gl_v3s, METH_OLDARGS}, - {"v4f", gl_v4f, METH_OLDARGS}, - {"v4i", gl_v4i, METH_OLDARGS}, - {"v4s", gl_v4s, METH_OLDARGS}, - {"videocmd", gl_videocmd, METH_OLDARGS}, - {"windepth", gl_windepth, METH_OLDARGS}, - {"wmpack", gl_wmpack, METH_OLDARGS}, - {"zdraw", gl_zdraw, METH_OLDARGS}, - {"zfunction", gl_zfunction, METH_OLDARGS}, - {"zsource", gl_zsource, METH_OLDARGS}, - {"zwritemask", gl_zwritemask, METH_OLDARGS}, - {"v2d", gl_v2d, METH_OLDARGS}, - {"v3d", gl_v3d, METH_OLDARGS}, - {"v4d", gl_v4d, METH_OLDARGS}, - {"pixmode", gl_pixmode, METH_OLDARGS}, - {"qgetfd", gl_qgetfd, METH_OLDARGS}, - {"dither", gl_dither, METH_OLDARGS}, - {NULL, NULL} /* Sentinel */ -}; - -void -initgl(void) -{ - (void) Py_InitModule("gl", gl_methods); -} diff --git a/Modules/imgfile.c b/Modules/imgfile.c deleted file mode 100644 index bb85a78..0000000 --- a/Modules/imgfile.c +++ /dev/null @@ -1,504 +0,0 @@ - -/* IMGFILE module - Interface to sgi libimage */ - -/* XXX This module should be done better at some point. It should return -** an object of image file class, and have routines to manipulate these -** image files in a neater way (so you can get rgb images off a greyscale -** file, for instance, or do a straight display without having to get the -** image bits into python, etc). -** -** Warning: this module is very non-reentrant (esp. the readscaled stuff) -*/ - -#include "Python.h" - -#include <gl/image.h> - -#include "/usr/people/4Dgifts/iristools/include/izoom.h" - -/* Bunch of missing extern decls; keep gcc -Wall happy... */ -extern void i_seterror(); -extern void iclose(); -extern void filterzoom(); -extern void putrow(); -extern void getrow(); - -static PyObject * ImgfileError; /* Exception we raise for various trouble */ - -static int top_to_bottom; /* True if we want top-to-bottom images */ - -/* The image library does not always call the error hander :-(, - therefore we have a global variable indicating that it was called. - It is cleared by imgfile_open(). */ - -static int error_called; - - -/* The error handler */ - -static void -imgfile_error(char *str) -{ - PyErr_SetString(ImgfileError, str); - error_called = 1; - return; /* To imglib, which will return a failure indicator */ -} - - -/* Open an image file and return a pointer to it. - Make sure we raise an exception if we fail. */ - -static IMAGE * -imgfile_open(char *fname) -{ - IMAGE *image; - i_seterror(imgfile_error); - error_called = 0; - errno = 0; - if ( (image = iopen(fname, "r")) == NULL ) { - /* Error may already be set by imgfile_error */ - if ( !error_called ) { - if (errno) - PyErr_SetFromErrno(ImgfileError); - else - PyErr_SetString(ImgfileError, - "Can't open image file"); - } - return NULL; - } - return image; -} - -static PyObject * -imgfile_ttob(PyObject *self, PyObject *args) -{ - int newval; - PyObject *rv; - - if (!PyArg_ParseTuple(args, "i:ttob", &newval)) - return NULL; - rv = PyInt_FromLong(top_to_bottom); - top_to_bottom = newval; - return rv; -} - -static PyObject * -imgfile_read(PyObject *self, PyObject *args) -{ - char *fname; - PyObject *rv; - int xsize, ysize, zsize; - char *cdatap; - long *idatap; - static short rs[8192], gs[8192], bs[8192]; - int x, y; - IMAGE *image; - int yfirst, ylast, ystep; - - if ( !PyArg_ParseTuple(args, "s:read", &fname) ) - return NULL; - - if ( (image = imgfile_open(fname)) == NULL ) - return NULL; - - if ( image->colormap != CM_NORMAL ) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can only handle CM_NORMAL images"); - return NULL; - } - if ( BPP(image->type) != 1 ) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can't handle imgfiles with bpp!=1"); - return NULL; - } - xsize = image->xsize; - ysize = image->ysize; - zsize = image->zsize; - if ( zsize != 1 && zsize != 3) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can only handle 1 or 3 byte pixels"); - return NULL; - } - if ( xsize > 8192 ) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can't handle image with > 8192 columns"); - return NULL; - } - - if ( zsize == 3 ) zsize = 4; - rv = PyString_FromStringAndSize((char *)NULL, xsize*ysize*zsize); - if ( rv == NULL ) { - iclose(image); - return NULL; - } - cdatap = PyString_AsString(rv); - idatap = (long *)cdatap; - - if (top_to_bottom) { - yfirst = ysize-1; - ylast = -1; - ystep = -1; - } else { - yfirst = 0; - ylast = ysize; - ystep = 1; - } - for ( y=yfirst; y != ylast && !error_called; y += ystep ) { - if ( zsize == 1 ) { - getrow(image, rs, y, 0); - for(x=0; x<xsize; x++ ) - *cdatap++ = rs[x]; - } else { - getrow(image, rs, y, 0); - getrow(image, gs, y, 1); - getrow(image, bs, y, 2); - for(x=0; x<xsize; x++ ) - *idatap++ = (rs[x] & 0xff) | - ((gs[x] & 0xff)<<8) | - ((bs[x] & 0xff)<<16); - } - } - iclose(image); - if ( error_called ) { - Py_DECREF(rv); - return NULL; - } - return rv; -} - -static IMAGE *glob_image; -static long *glob_datap; -static int glob_width, glob_z, glob_ysize; - -static void -xs_get(short *buf, int y) -{ - if (top_to_bottom) - getrow(glob_image, buf, (glob_ysize-1-y), glob_z); - else - getrow(glob_image, buf, y, glob_z); -} - -static void -xs_put_c(short *buf, int y) -{ - char *datap = (char *)glob_datap + y*glob_width; - int width = glob_width; - - while ( width-- ) - *datap++ = (*buf++) & 0xff; -} - -static void -xs_put_0(short *buf, int y) -{ - long *datap = glob_datap + y*glob_width; - int width = glob_width; - - while ( width-- ) - *datap++ = (*buf++) & 0xff; -} -static void -xs_put_12(short *buf, int y) -{ - long *datap = glob_datap + y*glob_width; - int width = glob_width; - - while ( width-- ) - *datap++ |= ((*buf++) & 0xff) << (glob_z*8); -} - -static void -xscale(IMAGE *image, int xsize, int ysize, int zsize, - long *datap, int xnew, int ynew, int fmode, double blur) -{ - glob_image = image; - glob_datap = datap; - glob_width = xnew; - glob_ysize = ysize; - if ( zsize == 1 ) { - glob_z = 0; - filterzoom(xs_get, xs_put_c, xsize, ysize, - xnew, ynew, fmode, blur); - } else { - glob_z = 0; - filterzoom(xs_get, xs_put_0, xsize, ysize, - xnew, ynew, fmode, blur); - glob_z = 1; - filterzoom(xs_get, xs_put_12, xsize, ysize, - xnew, ynew, fmode, blur); - glob_z = 2; - filterzoom(xs_get, xs_put_12, xsize, ysize, - xnew, ynew, fmode, blur); - } -} - - -static PyObject * -imgfile_readscaled(PyObject *self, PyObject *args) -{ - char *fname; - PyObject *rv; - int xsize, ysize, zsize; - char *cdatap; - long *idatap; - static short rs[8192], gs[8192], bs[8192]; - int x, y; - int xwtd, ywtd, xorig, yorig; - float xfac, yfac; - IMAGE *image; - char *filter; - double blur = 1.0; - int extended; - int fmode = 0; - int yfirst, ylast, ystep; - - /* - ** Parse args. Funny, since arg 4 and 5 are optional - ** (filter name and blur factor). Also, 4 or 5 arguments indicates - ** extended scale algorithm in stead of simple-minded pixel drop/dup. - */ - extended = PyTuple_Size(args) >= 4; - if ( !PyArg_ParseTuple(args, "sii|sd", - &fname, &xwtd, &ywtd, &filter, &blur) ) - return NULL; - - /* - ** Check parameters, open file and check type, rows, etc. - */ - if ( extended ) { - if ( strcmp(filter, "impulse") == 0 ) - fmode = IMPULSE; - else if ( strcmp( filter, "box") == 0 ) - fmode = BOX; - else if ( strcmp( filter, "triangle") == 0 ) - fmode = TRIANGLE; - else if ( strcmp( filter, "quadratic") == 0 ) - fmode = QUADRATIC; - else if ( strcmp( filter, "gaussian") == 0 ) - fmode = GAUSSIAN; - else { - PyErr_SetString(ImgfileError, "Unknown filter type"); - return NULL; - } - } - - if ( (image = imgfile_open(fname)) == NULL ) - return NULL; - - if ( image->colormap != CM_NORMAL ) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can only handle CM_NORMAL images"); - return NULL; - } - if ( BPP(image->type) != 1 ) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can't handle imgfiles with bpp!=1"); - return NULL; - } - xsize = image->xsize; - ysize = image->ysize; - zsize = image->zsize; - if ( zsize != 1 && zsize != 3) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can only handle 1 or 3 byte pixels"); - return NULL; - } - if ( xsize > 8192 ) { - iclose(image); - PyErr_SetString(ImgfileError, - "Can't handle image with > 8192 columns"); - return NULL; - } - - if ( zsize == 3 ) zsize = 4; - rv = PyString_FromStringAndSize(NULL, xwtd*ywtd*zsize); - if ( rv == NULL ) { - iclose(image); - return NULL; - } - PyFPE_START_PROTECT("readscaled", return 0) - xfac = (float)xsize/(float)xwtd; - yfac = (float)ysize/(float)ywtd; - PyFPE_END_PROTECT(yfac) - cdatap = PyString_AsString(rv); - idatap = (long *)cdatap; - - if ( extended ) { - xscale(image, xsize, ysize, zsize, - idatap, xwtd, ywtd, fmode, blur); - } else { - if (top_to_bottom) { - yfirst = ywtd-1; - ylast = -1; - ystep = -1; - } else { - yfirst = 0; - ylast = ywtd; - ystep = 1; - } - for ( y=yfirst; y != ylast && !error_called; y += ystep ) { - yorig = (int)(y*yfac); - if ( zsize == 1 ) { - getrow(image, rs, yorig, 0); - for(x=0; x<xwtd; x++ ) { - *cdatap++ = rs[(int)(x*xfac)]; - } - } else { - getrow(image, rs, yorig, 0); - getrow(image, gs, yorig, 1); - getrow(image, bs, yorig, 2); - for(x=0; x<xwtd; x++ ) { - xorig = (int)(x*xfac); - *idatap++ = (rs[xorig] & 0xff) | - ((gs[xorig] & 0xff)<<8) | - ((bs[xorig] & 0xff)<<16); - } - } - } - } - iclose(image); - if ( error_called ) { - Py_DECREF(rv); - return NULL; - } - return rv; -} - -static PyObject * -imgfile_getsizes(PyObject *self, PyObject *args) -{ - char *fname; - PyObject *rv; - IMAGE *image; - - if ( !PyArg_ParseTuple(args, "s:getsizes", &fname) ) - return NULL; - - if ( (image = imgfile_open(fname)) == NULL ) - return NULL; - rv = Py_BuildValue("(iii)", image->xsize, image->ysize, image->zsize); - iclose(image); - return rv; -} - -static PyObject * -imgfile_write(PyObject *self, PyObject *args) -{ - IMAGE *image; - char *fname; - int xsize, ysize, zsize, len; - char *cdatap; - long *idatap; - short rs[8192], gs[8192], bs[8192]; - short r, g, b; - long rgb; - int x, y; - int yfirst, ylast, ystep; - - - if ( !PyArg_ParseTuple(args, "ss#iii:write", - &fname, &cdatap, &len, &xsize, &ysize, &zsize) ) - return NULL; - - if ( zsize != 1 && zsize != 3 ) { - PyErr_SetString(ImgfileError, - "Can only handle 1 or 3 byte pixels"); - return NULL; - } - if ( len != xsize * ysize * (zsize == 1 ? 1 : 4) ) { - PyErr_SetString(ImgfileError, "Data does not match sizes"); - return NULL; - } - if ( xsize > 8192 ) { - PyErr_SetString(ImgfileError, - "Can't handle image with > 8192 columns"); - return NULL; - } - - error_called = 0; - errno = 0; - image =iopen(fname, "w", RLE(1), 3, xsize, ysize, zsize); - if ( image == 0 ) { - if ( ! error_called ) { - if (errno) - PyErr_SetFromErrno(ImgfileError); - else - PyErr_SetString(ImgfileError, - "Can't create image file"); - } - return NULL; - } - - idatap = (long *)cdatap; - - if (top_to_bottom) { - yfirst = ysize-1; - ylast = -1; - ystep = -1; - } else { - yfirst = 0; - ylast = ysize; - ystep = 1; - } - for ( y=yfirst; y != ylast && !error_called; y += ystep ) { - if ( zsize == 1 ) { - for( x=0; x<xsize; x++ ) - rs[x] = *cdatap++; - putrow(image, rs, y, 0); - } else { - for( x=0; x<xsize; x++ ) { - rgb = *idatap++; - r = rgb & 0xff; - g = (rgb >> 8 ) & 0xff; - b = (rgb >> 16 ) & 0xff; - rs[x] = r; - gs[x] = g; - bs[x] = b; - } - putrow(image, rs, y, 0); - putrow(image, gs, y, 1); - putrow(image, bs, y, 2); - } - } - iclose(image); - if ( error_called ) - return NULL; - Py_INCREF(Py_None); - return Py_None; - -} - - -static PyMethodDef imgfile_methods[] = { - { "getsizes", imgfile_getsizes, METH_VARARGS }, - { "read", imgfile_read, METH_VARARGS }, - { "readscaled", imgfile_readscaled, METH_VARARGS}, - { "write", imgfile_write, METH_VARARGS }, - { "ttob", imgfile_ttob, METH_VARARGS }, - { NULL, NULL } /* Sentinel */ -}; - - -void -initimgfile(void) -{ - PyObject *m, *d; - m = Py_InitModule("imgfile", imgfile_methods); - if (m == NULL) - return; - d = PyModule_GetDict(m); - ImgfileError = PyErr_NewException("imgfile.error", NULL, NULL); - if (ImgfileError != NULL) - PyDict_SetItemString(d, "error", ImgfileError); -} - - - diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index 249fc1a..f170c51 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -867,7 +867,8 @@ VALIDATER(while); VALIDATER(for); VALIDATER(try); VALIDATER(except_clause); VALIDATER(test); VALIDATER(and_test); VALIDATER(not_test); VALIDATER(comparison); -VALIDATER(comp_op); VALIDATER(expr); +VALIDATER(comp_op); +VALIDATER(star_expr); VALIDATER(expr); VALIDATER(xor_expr); VALIDATER(and_expr); VALIDATER(shift_expr); VALIDATER(arith_expr); VALIDATER(term); VALIDATER(factor); @@ -2094,11 +2095,11 @@ validate_comparison(node *tree) int nch = NCH(tree); int res = (validate_ntype(tree, comparison) && is_odd(nch) - && validate_expr(CHILD(tree, 0))); + && validate_star_expr(CHILD(tree, 0))); for (pos = 1; res && (pos < nch); pos += 2) res = (validate_comp_op(CHILD(tree, pos)) - && validate_expr(CHILD(tree, pos + 1))); + && validate_star_expr(CHILD(tree, pos + 1))); return (res); } @@ -2156,6 +2157,20 @@ validate_comp_op(node *tree) static int +validate_star_expr(node *tree) +{ + int res = validate_ntype(tree, star_expr); + if (!res) return res; + if (NCH(tree) == 2) { + return validate_ntype(CHILD(tree, 0), STAR) && \ + validate_expr(CHILD(tree, 1)); + } else { + return validate_expr(CHILD(tree, 0)); + } +} + + +static int validate_expr(node *tree) { int j; @@ -2745,7 +2760,7 @@ static int validate_exprlist(node *tree) { return (validate_repeating_list(tree, exprlist, - validate_expr, "exprlist")); + validate_star_expr, "exprlist")); } diff --git a/Modules/sgimodule.c b/Modules/sgimodule.c deleted file mode 100644 index f7e1263..0000000 --- a/Modules/sgimodule.c +++ /dev/null @@ -1,55 +0,0 @@ - -/* SGI module -- random SGI-specific things */ - -#include "Python.h" - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - -static PyObject * -sgi_nap(PyObject *self, PyObject *args) -{ - long ticks; - if (!PyArg_ParseTuple(args, "l:nap", &ticks)) - return NULL; - Py_BEGIN_ALLOW_THREADS - sginap(ticks); - Py_END_ALLOW_THREADS - Py_INCREF(Py_None); - return Py_None; -} - -extern char *_getpty(int *, int, mode_t, int); - -static PyObject * -sgi__getpty(PyObject *self, PyObject *args) -{ - int oflag; - int mode; - int nofork; - char *name; - int fildes; - if (!PyArg_ParseTuple(args, "iii:_getpty", &oflag, &mode, &nofork)) - return NULL; - errno = 0; - name = _getpty(&fildes, oflag, (mode_t)mode, nofork); - if (name == NULL) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - return Py_BuildValue("(si)", name, fildes); -} - -static PyMethodDef sgi_methods[] = { - {"nap", sgi_nap, METH_VARARGS}, - {"_getpty", sgi__getpty, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - - -void -initsgi(void) -{ - Py_InitModule("sgi", sgi_methods); -} diff --git a/Modules/svmodule.c b/Modules/svmodule.c deleted file mode 100644 index fb58f19..0000000 --- a/Modules/svmodule.c +++ /dev/null @@ -1,966 +0,0 @@ -/* SV module -- interface to the Indigo video board */ - -/* WARNING! This module is for hardware that we don't have any more, - so it hasn't been tested. It has been converted to the new coding - style, and it is possible that this conversion has broken something - -- user beware! */ - -#include <sys/time.h> -#include <svideo.h> -#include "Python.h" -#include "compile.h" -#include "yuv.h" /* for YUV conversion functions */ - -typedef struct { - PyObject_HEAD - SV_nodeP ob_svideo; - svCaptureInfo ob_info; -} svobject; - -typedef struct { - PyObject_HEAD - void *ob_capture; - int ob_mustunlock; - svCaptureInfo ob_info; - svobject *ob_svideo; -} captureobject; - -static PyObject *SvError; /* exception sv.error */ - -static PyObject *newcaptureobject(svobject *, void *, int); - -/* Set a SV-specific error from svideo_errno and return NULL */ -static PyObject * -sv_error(void) -{ - PyErr_SetString(SvError, svStrerror(svideo_errno)); - return NULL; -} - -static PyObject * -svc_conversion(captureobject *self, PyObject *args, void (*function)(), float factor) -{ - PyObject *output; - int invert; - char* outstr; - - if (!PyArg_Parse(args, "i", &invert)) - return NULL; - - if (!(output = PyString_FromStringAndSize( - NULL, - (int)(self->ob_info.width * self->ob_info.height * factor)))) - { - return NULL; - } - if (!(outstr = PyString_AsString(output))) { - Py_DECREF(output); - return NULL; - } - - (*function)((boolean)invert, self->ob_capture, - outstr, - self->ob_info.width, self->ob_info.height); - - return output; -} - -/* - * 3 functions to convert from Starter Video YUV 4:1:1 format to - * Compression Library 4:2:2 Duplicate Chroma format. - */ -static PyObject * -svc_YUVtoYUV422DC(captureobject *self, PyObject *args) -{ - if (self->ob_info.format != SV_YUV411_FRAMES) { - PyErr_SetString(SvError, "data has bad format"); - return NULL; - } - return svc_conversion(self, args, yuv_sv411_to_cl422dc, 2.0); -} - -static PyObject * -svc_YUVtoYUV422DC_quarter(captureobject *self, PyObject *args) -{ - if (self->ob_info.format != SV_YUV411_FRAMES) { - PyErr_SetString(SvError, "data has bad format"); - return NULL; - } - return svc_conversion(self, args, - yuv_sv411_to_cl422dc_quartersize, 0.5); -} - -static PyObject * -svc_YUVtoYUV422DC_sixteenth(captureobject *self, PyObject *args) -{ - if (self->ob_info.format != SV_YUV411_FRAMES) { - PyErr_SetString(SvError, "data has bad format"); - return NULL; - } - return svc_conversion(self, args, - yuv_sv411_to_cl422dc_sixteenthsize, 0.125); -} - -static PyObject * -svc_YUVtoRGB(captureobject *self, PyObject *args) -{ - switch (self->ob_info.format) { - case SV_YUV411_FRAMES: - case SV_YUV411_FRAMES_AND_BLANKING_BUFFER: - break; - default: - PyErr_SetString(SvError, "data had bad format"); - return NULL; - } - return svc_conversion(self, args, svYUVtoRGB, (float) sizeof(long)); -} - -static PyObject * -svc_RGB8toRGB32(captureobject *self, PyObject *args) -{ - if (self->ob_info.format != SV_RGB8_FRAMES) { - PyErr_SetString(SvError, "data has bad format"); - return NULL; - } - return svc_conversion(self, args, svRGB8toRGB32, (float) sizeof(long)); -} - -static PyObject * -svc_InterleaveFields(captureobject *self, PyObject *args) -{ - if (self->ob_info.format != SV_RGB8_FRAMES) { - PyErr_SetString(SvError, "data has bad format"); - return NULL; - } - return svc_conversion(self, args, svInterleaveFields, 1.0); -} - -static PyObject * -svc_GetFields(captureobject *self, PyObject *args) -{ - PyObject *f1 = NULL; - PyObject *f2 = NULL; - PyObject *ret = NULL; - int fieldsize; - char* obcapture; - - if (self->ob_info.format != SV_RGB8_FRAMES) { - PyErr_SetString(SvError, "data has bad format"); - return NULL; - } - - fieldsize = self->ob_info.width * self->ob_info.height / 2; - obcapture = (char*)self->ob_capture; - - if (!(f1 = PyString_FromStringAndSize(obcapture, fieldsize))) - goto finally; - if (!(f2 = PyString_FromStringAndSize(obcapture + fieldsize, - fieldsize))) - goto finally; - ret = PyTuple_Pack(2, f1, f2); - - finally: - Py_XDECREF(f1); - Py_XDECREF(f2); - return ret; -} - -static PyObject * -svc_UnlockCaptureData(captureobject *self, PyObject *args) -{ - if (!PyArg_Parse(args, "")) - return NULL; - - if (!self->ob_mustunlock) { - PyErr_SetString(SvError, "buffer should not be unlocked"); - return NULL; - } - - if (svUnlockCaptureData(self->ob_svideo->ob_svideo, self->ob_capture)) - return sv_error(); - - self->ob_mustunlock = 0; - - Py_INCREF(Py_None); - return Py_None; -} - -#ifdef USE_GL -#include <gl.h> - -static PyObject * -svc_lrectwrite(captureobject *self, PyObject *args) -{ - Screencoord x1, x2, y1, y2; - - if (!PyArg_Parse(args, "(hhhh)", &x1, &x2, &y1, &y2)) - return NULL; - - lrectwrite(x1, x2, y1, y2, (unsigned long *) self->ob_capture); - - Py_INCREF(Py_None); - return Py_None; -} -#endif - -static PyObject * -svc_writefile(captureobject *self, PyObject *args) -{ - PyObject *file; - int size; - FILE* fp; - - if (!PyArg_Parse(args, "O", &file)) - return NULL; - - if (!PyFile_Check(file)) { - PyErr_SetString(SvError, "not a file object"); - return NULL; - } - - if (!(fp = PyFile_AsFile(file))) - return NULL; - - size = self->ob_info.width * self->ob_info.height; - - if (fwrite(self->ob_capture, sizeof(long), size, fp) != size) { - PyErr_SetString(SvError, "writing failed"); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -svc_FindVisibleRegion(captureobject *self, PyObject *args) -{ - void *visible; - int width; - - if (!PyArg_Parse(args, "")) - return NULL; - - if (svFindVisibleRegion(self->ob_svideo->ob_svideo, - self->ob_capture, &visible, - self->ob_info.width)) - return sv_error(); - - if (visible == NULL) { - PyErr_SetString(SvError, "data in wrong format"); - return NULL; - } - - return newcaptureobject(self->ob_svideo, visible, 0); -} - -static PyMethodDef capture_methods[] = { - {"YUVtoRGB", (PyCFunction)svc_YUVtoRGB, METH_OLDARGS}, - {"RGB8toRGB32", (PyCFunction)svc_RGB8toRGB32, METH_OLDARGS}, - {"InterleaveFields", (PyCFunction)svc_InterleaveFields, METH_OLDARGS}, - {"UnlockCaptureData", (PyCFunction)svc_UnlockCaptureData, METH_OLDARGS}, - {"FindVisibleRegion", (PyCFunction)svc_FindVisibleRegion, METH_OLDARGS}, - {"GetFields", (PyCFunction)svc_GetFields, METH_OLDARGS}, - {"YUVtoYUV422DC", (PyCFunction)svc_YUVtoYUV422DC, METH_OLDARGS}, - {"YUVtoYUV422DC_quarter",(PyCFunction)svc_YUVtoYUV422DC_quarter, METH_OLDARGS}, - {"YUVtoYUV422DC_sixteenth",(PyCFunction)svc_YUVtoYUV422DC_sixteenth, METH_OLDARGS}, -#ifdef USE_GL - {"lrectwrite", (PyCFunction)svc_lrectwrite, METH_OLDARGS}, -#endif - {"writefile", (PyCFunction)svc_writefile, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -static void -capture_dealloc(captureobject *self) -{ - if (self->ob_capture != NULL) { - if (self->ob_mustunlock) - (void)svUnlockCaptureData(self->ob_svideo->ob_svideo, - self->ob_capture); - self->ob_capture = NULL; - Py_DECREF(self->ob_svideo); - self->ob_svideo = NULL; - } - PyObject_Del(self); -} - -static PyObject * -capture_getattr(svobject *self, char *name) -{ - return Py_FindMethod(capture_methods, (PyObject *)self, name); -} - -PyTypeObject Capturetype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "sv.capture", /*tp_name*/ - sizeof(captureobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)capture_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)capture_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ -}; - -static PyObject * -newcaptureobject(svobject *self, void *ptr, int mustunlock) -{ - captureobject *p; - - p = PyObject_New(captureobject, &Capturetype); - if (p == NULL) - return NULL; - p->ob_svideo = self; - Py_INCREF(self); - p->ob_capture = ptr; - p->ob_mustunlock = mustunlock; - p->ob_info = self->ob_info; - return (PyObject *) p; -} - -static PyObject * -sv_GetCaptureData(svobject *self, PyObject *args) -{ - void *ptr; - long fieldID; - PyObject *res, *c; - - if (!PyArg_Parse(args, "")) - return NULL; - - if (svGetCaptureData(self->ob_svideo, &ptr, &fieldID)) - return sv_error(); - - if (ptr == NULL) { - PyErr_SetString(SvError, "no data available"); - return NULL; - } - - c = newcaptureobject(self, ptr, 1); - if (c == NULL) - return NULL; - res = Py_BuildValue("(Oi)", c, fieldID); - Py_DECREF(c); - return res; -} - -static PyObject * -sv_BindGLWindow(svobject *self, PyObject *args) -{ - long wid; - int mode; - - if (!PyArg_Parse(args, "(ii)", &wid, &mode)) - return NULL; - - if (svBindGLWindow(self->ob_svideo, wid, mode)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_EndContinuousCapture(svobject *self, PyObject *args) -{ - - if (!PyArg_Parse(args, "")) - return NULL; - - if (svEndContinuousCapture(self->ob_svideo)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_IsVideoDisplayed(svobject *self, PyObject *args) -{ - int v; - - if (!PyArg_Parse(args, "")) - return NULL; - - v = svIsVideoDisplayed(self->ob_svideo); - if (v == -1) - return sv_error(); - - return PyInt_FromLong((long) v); -} - -static PyObject * -sv_OutputOffset(svobject *self, PyObject *args) -{ - int x_offset; - int y_offset; - - if (!PyArg_Parse(args, "(ii)", &x_offset, &y_offset)) - return NULL; - - if (svOutputOffset(self->ob_svideo, x_offset, y_offset)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_PutFrame(svobject *self, PyObject *args) -{ - char *buffer; - - if (!PyArg_Parse(args, "s", &buffer)) - return NULL; - - if (svPutFrame(self->ob_svideo, buffer)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_QuerySize(svobject *self, PyObject *args) -{ - int w; - int h; - int rw; - int rh; - - if (!PyArg_Parse(args, "(ii)", &w, &h)) - return NULL; - - if (svQuerySize(self->ob_svideo, w, h, &rw, &rh)) - return sv_error(); - - return Py_BuildValue("(ii)", (long) rw, (long) rh); -} - -static PyObject * -sv_SetSize(svobject *self, PyObject *args) -{ - int w; - int h; - - if (!PyArg_Parse(args, "(ii)", &w, &h)) - return NULL; - - if (svSetSize(self->ob_svideo, w, h)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_SetStdDefaults(svobject *self, PyObject *args) -{ - - if (!PyArg_Parse(args, "")) - return NULL; - - if (svSetStdDefaults(self->ob_svideo)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_UseExclusive(svobject *self, PyObject *args) -{ - boolean onoff; - int mode; - - if (!PyArg_Parse(args, "(ii)", &onoff, &mode)) - return NULL; - - if (svUseExclusive(self->ob_svideo, onoff, mode)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_WindowOffset(svobject *self, PyObject *args) -{ - int x_offset; - int y_offset; - - if (!PyArg_Parse(args, "(ii)", &x_offset, &y_offset)) - return NULL; - - if (svWindowOffset(self->ob_svideo, x_offset, y_offset)) - return sv_error(); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -sv_CaptureBurst(svobject *self, PyObject *args) -{ - int bytes, i; - svCaptureInfo info; - void *bitvector = NULL; - PyObject *videodata = NULL; - PyObject *bitvecobj = NULL; - PyObject *res = NULL; - static PyObject *evenitem, *odditem; - - if (!PyArg_Parse(args, "(iiiii)", &info.format, - &info.width, &info.height, - &info.size, &info.samplingrate)) - return NULL; - - switch (info.format) { - case SV_RGB8_FRAMES: - bitvector = malloc(SV_BITVEC_SIZE(info.size)); - break; - case SV_YUV411_FRAMES_AND_BLANKING_BUFFER: - break; - default: - PyErr_SetString(SvError, "illegal format specified"); - return NULL; - } - - if (svQueryCaptureBufferSize(self->ob_svideo, &info, &bytes)) { - res = sv_error(); - goto finally; - } - - if (!(videodata = PyString_FromStringAndSize(NULL, bytes))) - goto finally; - - /* XXX -- need to do something about the bitvector */ - { - char* str = PyString_AsString(videodata); - if (!str) - goto finally; - - if (svCaptureBurst(self->ob_svideo, &info, str, bitvector)) { - res = sv_error(); - goto finally; - } - } - - if (bitvector) { - if (evenitem == NULL) { - if (!(evenitem = PyInt_FromLong(0))) - goto finally; - } - if (odditem == NULL) { - if (!(odditem = PyInt_FromLong(1))) - goto finally; - } - if (!(bitvecobj = PyTuple_New(2 * info.size))) - goto finally; - - for (i = 0; i < 2 * info.size; i++) { - int sts; - - if (SV_GET_FIELD(bitvector, i) == SV_EVEN_FIELD) { - Py_INCREF(evenitem); - sts = PyTuple_SetItem(bitvecobj, i, evenitem); - } else { - Py_INCREF(odditem); - sts = PyTuple_SetItem(bitvecobj, i, odditem); - } - if (sts < 0) - goto finally; - } - } else { - bitvecobj = Py_None; - Py_INCREF(Py_None); - } - - res = Py_BuildValue("((iiiii)OO)", info.format, - info.width, info.height, - info.size, info.samplingrate, - videodata, bitvecobj); - - finally: - if (bitvector) - free(bitvector); - - Py_XDECREF(videodata); - Py_XDECREF(bitvecobj); - return res; -} - -static PyObject * -sv_CaptureOneFrame(svobject *self, PyObject *args) -{ - svCaptureInfo info; - int format, width, height; - int bytes; - PyObject *videodata = NULL; - PyObject *res = NULL; - char *str; - - if (!PyArg_Parse(args, "(iii)", &format, &width, &height)) - return NULL; - - info.format = format; - info.width = width; - info.height = height; - info.size = 0; - info.samplingrate = 0; - if (svQueryCaptureBufferSize(self->ob_svideo, &info, &bytes)) - return sv_error(); - - if (!(videodata = PyString_FromStringAndSize(NULL, bytes))) - return NULL; - - str = PyString_AsString(videodata); - if (!str) - goto finally; - - if (svCaptureOneFrame(self->ob_svideo, format, &width, &height, str)) { - res = sv_error(); - goto finally; - } - - res = Py_BuildValue("(iiO)", width, height, videodata); - - finally: - Py_XDECREF(videodata); - return res; -} - -static PyObject * -sv_InitContinuousCapture(svobject *self, PyObject *args) -{ - svCaptureInfo info; - - if (!PyArg_Parse(args, "(iiiii)", &info.format, - &info.width, &info.height, - &info.size, &info.samplingrate)) - return NULL; - - if (svInitContinuousCapture(self->ob_svideo, &info)) - return sv_error(); - - self->ob_info = info; - - return Py_BuildValue("(iiiii)", info.format, info.width, info.height, - info.size, info.samplingrate); -} - -static PyObject * -sv_LoadMap(svobject *self, PyObject *args) -{ - PyObject *rgb; - PyObject *res = NULL; - rgb_tuple *mapp = NULL; - int maptype; - int i, j; /* indices */ - - if (!PyArg_Parse(args, "(iO)", &maptype, &rgb)) - return NULL; - - if (!PyList_Check(rgb) || PyList_Size(rgb) != 256) { - PyErr_BadArgument(); - return NULL; - } - - if (!(mapp = PyMem_NEW(rgb_tuple, 256))) - return PyErr_NoMemory(); - - for (i = 0; i < 256; i++) { - PyObject* v = PyList_GetItem(rgb, i); - if (!v) - goto finally; - - if (!PyTuple_Check(v) || PyTuple_Size(v) != 3) { - PyErr_BadArgument(); - goto finally; - } - for (j = 0; j < 3; j++) { - PyObject* cell = PyTuple_GetItem(v, j); - if (!cell) - goto finally; - - if (!PyInt_Check(cell)) { - PyErr_BadArgument(); - goto finally; - } - switch (j) { - case 0: mapp[i].red = PyInt_AsLong(cell); break; - case 1: mapp[i].blue = PyInt_AsLong(cell); break; - case 2: mapp[i].green = PyInt_AsLong(cell); break; - } - if (PyErr_Occurred()) - goto finally; - } - } - - if (svLoadMap(self->ob_svideo, maptype, mapp)) { - res = sv_error(); - goto finally; - } - - Py_INCREF(Py_None); - res = Py_None; - - finally: - PyMem_DEL(mapp); - return res; -} - -static PyObject * -sv_CloseVideo(svobject *self, PyObject *args) -{ - if (!PyArg_Parse(args, "")) - return NULL; - - if (svCloseVideo(self->ob_svideo)) - return sv_error(); - - self->ob_svideo = NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -doParams(svobject *self, PyObject *args, - int (*func)(SV_nodeP, long *, int), int modified) -{ - PyObject *list; - PyObject *res = NULL; - long *PVbuffer = NULL; - long length; - int i; - - if (!PyArg_Parse(args, "O", &list)) - return NULL; - - if (!PyList_Check(list)) { - PyErr_BadArgument(); - return NULL; - } - - if ((length = PyList_Size(list)) < 0) - return NULL; - - PVbuffer = PyMem_NEW(long, length); - if (PVbuffer == NULL) - return PyErr_NoMemory(); - - for (i = 0; i < length; i++) { - PyObject *v = PyList_GetItem(list, i); - if (!v) - goto finally; - - if (!PyInt_Check(v)) { - PyErr_BadArgument(); - goto finally; - } - PVbuffer[i] = PyInt_AsLong(v); - /* can't just test the return value, because what if the - value was -1?! - */ - if (PVbuffer[i] == -1 && PyErr_Occurred()) - goto finally; - } - - if ((*func)(self->ob_svideo, PVbuffer, length)) { - res = sv_error(); - goto finally; - } - - if (modified) { - for (i = 0; i < length; i++) { - PyObject* v = PyInt_FromLong(PVbuffer[i]); - if (!v || PyList_SetItem(list, i, v) < 0) - goto finally; - } - } - - Py_INCREF(Py_None); - res = Py_None; - - finally: - PyMem_DEL(PVbuffer); - return res; -} - -static PyObject * -sv_GetParam(PyObject *self, PyObject *args) -{ - return doParams(self, args, svGetParam, 1); -} - -static PyObject * -sv_GetParamRange(PyObject *self, PyObject *args) -{ - return doParams(self, args, svGetParamRange, 1); -} - -static PyObject * -sv_SetParam(PyObject *self, PyObject *args) -{ - return doParams(self, args, svSetParam, 0); -} - -static PyMethodDef svideo_methods[] = { - {"BindGLWindow", (PyCFunction)sv_BindGLWindow, METH_OLDARGS}, - {"EndContinuousCapture",(PyCFunction)sv_EndContinuousCapture, METH_OLDARGS}, - {"IsVideoDisplayed", (PyCFunction)sv_IsVideoDisplayed, METH_OLDARGS}, - {"OutputOffset", (PyCFunction)sv_OutputOffset, METH_OLDARGS}, - {"PutFrame", (PyCFunction)sv_PutFrame, METH_OLDARGS}, - {"QuerySize", (PyCFunction)sv_QuerySize, METH_OLDARGS}, - {"SetSize", (PyCFunction)sv_SetSize, METH_OLDARGS}, - {"SetStdDefaults", (PyCFunction)sv_SetStdDefaults, METH_OLDARGS}, - {"UseExclusive", (PyCFunction)sv_UseExclusive, METH_OLDARGS}, - {"WindowOffset", (PyCFunction)sv_WindowOffset, METH_OLDARGS}, - {"InitContinuousCapture",(PyCFunction)sv_InitContinuousCapture, METH_OLDARGS}, - {"CaptureBurst", (PyCFunction)sv_CaptureBurst, METH_OLDARGS}, - {"CaptureOneFrame", (PyCFunction)sv_CaptureOneFrame, METH_OLDARGS}, - {"GetCaptureData", (PyCFunction)sv_GetCaptureData, METH_OLDARGS}, - {"CloseVideo", (PyCFunction)sv_CloseVideo, METH_OLDARGS}, - {"LoadMap", (PyCFunction)sv_LoadMap, METH_OLDARGS}, - {"GetParam", (PyCFunction)sv_GetParam, METH_OLDARGS}, - {"GetParamRange", (PyCFunction)sv_GetParamRange, METH_OLDARGS}, - {"SetParam", (PyCFunction)sv_SetParam, METH_OLDARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -sv_conversion(PyObject *self, PyObject *args, void (*function)(), - int inputfactor, float factor) -{ - int invert, width, height, inputlength; - char *input, *str; - PyObject *output; - - if (!PyArg_Parse(args, "(is#ii)", &invert, - &input, &inputlength, &width, &height)) - return NULL; - - if (width * height * inputfactor > inputlength) { - PyErr_SetString(SvError, "input buffer not long enough"); - return NULL; - } - - if (!(output = PyString_FromStringAndSize(NULL, - (int)(width * height * factor)))) - return NULL; - - str = PyString_AsString(output); - if (!str) { - Py_DECREF(output); - return NULL; - } - (*function)(invert, input, str, width, height); - - return output; -} - -static PyObject * -sv_InterleaveFields(PyObject *self, PyObject *args) -{ - return sv_conversion(self, args, svInterleaveFields, 1, 1.0); -} - -static PyObject * -sv_RGB8toRGB32(PyObject *self, PyObject *args) -{ - return sv_conversion(self, args, svRGB8toRGB32, 1, (float) sizeof(long)); -} - -static PyObject * -sv_YUVtoRGB(PyObject *self, PyObject *args) -{ - return sv_conversion(self, args, svYUVtoRGB, 2, (float) sizeof(long)); -} - -static void -svideo_dealloc(svobject *self) -{ - if (self->ob_svideo != NULL) - (void) svCloseVideo(self->ob_svideo); - PyObject_Del(self); -} - -static PyObject * -svideo_getattr(svobject *self, char *name) -{ - return Py_FindMethod(svideo_methods, (PyObject *)self, name); -} - -PyTypeObject Svtype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "sv.sv", /*tp_name*/ - sizeof(svobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)svideo_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)svideo_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ -}; - -static PyObject * -newsvobject(SV_nodeP svp) -{ - svobject *p; - - p = PyObject_New(svobject, &Svtype); - if (p == NULL) - return NULL; - p->ob_svideo = svp; - p->ob_info.format = 0; - p->ob_info.size = 0; - p->ob_info.width = 0; - p->ob_info.height = 0; - p->ob_info.samplingrate = 0; - return (PyObject *) p; -} - -static PyObject * -sv_OpenVideo(PyObject *self, PyObject *args) -{ - SV_nodeP svp; - - if (!PyArg_Parse(args, "")) - return NULL; - - svp = svOpenVideo(); - if (svp == NULL) - return sv_error(); - - return newsvobject(svp); -} - -static PyMethodDef sv_methods[] = { - {"InterleaveFields", (PyCFunction)sv_InterleaveFields, METH_OLDARGS}, - {"RGB8toRGB32", (PyCFunction)sv_RGB8toRGB32, METH_OLDARGS}, - {"YUVtoRGB", (PyCFunction)sv_YUVtoRGB, METH_OLDARGS}, - {"OpenVideo", (PyCFunction)sv_OpenVideo, METH_OLDARGS}, - {NULL, NULL} /* Sentinel */ -}; - -void -initsv(void) -{ - PyObject *m, *d; - - m = Py_InitModule("sv", sv_methods); - if (m == NULL) - return; - d = PyModule_GetDict(m); - - SvError = PyErr_NewException("sv.error", NULL, NULL); - if (SvError == NULL || PyDict_SetItemString(d, "error", SvError) != 0) - return; -} |