1991-09-09 20:33:34 -03:00
|
|
|
/**********************************************************
|
1995-01-04 15:10:35 -04:00
|
|
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
|
|
|
The Netherlands.
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
All Rights Reserved
|
|
|
|
|
1996-10-25 11:44:06 -03:00
|
|
|
Permission to use, copy, modify, and distribute this software and its
|
|
|
|
documentation for any purpose and without fee is hereby granted,
|
1991-09-09 20:33:34 -03:00
|
|
|
provided that the above copyright notice appear in all copies and that
|
1996-10-25 11:44:06 -03:00
|
|
|
both that copyright notice and this permission notice appear in
|
1991-09-09 20:33:34 -03:00
|
|
|
supporting documentation, and that the names of Stichting Mathematisch
|
1996-10-25 11:44:06 -03:00
|
|
|
Centrum or CWI or Corporation for National Research Initiatives or
|
|
|
|
CNRI not be used in advertising or publicity pertaining to
|
|
|
|
distribution of the software without specific, written prior
|
|
|
|
permission.
|
|
|
|
|
|
|
|
While CWI is the initial source for this software, a modified version
|
|
|
|
is made available by the Corporation for National Research Initiatives
|
|
|
|
(CNRI) at the Internet address ftp://ftp.python.org.
|
|
|
|
|
|
|
|
STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
|
|
|
|
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
|
|
|
|
CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
|
|
|
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
|
|
|
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
PERFORMANCE OF THIS SOFTWARE.
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
******************************************************************/
|
|
|
|
|
1992-05-15 08:06:29 -03:00
|
|
|
/* AL module -- interface to Mark Callow's Audio Library (AL). */
|
1991-09-09 20:33:34 -03:00
|
|
|
|
1994-08-01 08:34:53 -03:00
|
|
|
#include <audio.h>
|
1991-09-09 20:33:34 -03:00
|
|
|
|
1993-02-10 10:10:56 -04:00
|
|
|
/* Check which version audio library we have: */
|
|
|
|
#ifdef AL_ERROR_NUMBER
|
|
|
|
#define AL_405
|
|
|
|
/* XXXX 4.0.5 libaudio also allows us to provide better error
|
|
|
|
** handling (with ALseterrorhandler). We should implement that
|
|
|
|
** sometime.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
#include "Python.h"
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
/* Config objects */
|
|
|
|
|
|
|
|
typedef struct {
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject_HEAD
|
1991-09-09 20:33:34 -03:00
|
|
|
ALconfig ob_config;
|
|
|
|
} configobject;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
staticforward PyTypeObject Configtype;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
#define is_configobject(v) ((v)->ob_type == &Configtype)
|
|
|
|
|
1992-01-27 12:45:55 -04:00
|
|
|
/* Forward */
|
1997-01-03 18:40:34 -04:00
|
|
|
static int getconfigarg Py_PROTO((PyObject *, ALconfig *));
|
|
|
|
static int getstrstrconfigarg Py_PROTO((PyObject *, char **, char **,
|
|
|
|
ALconfig *));
|
1992-01-27 12:45:55 -04:00
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
setConfig (self, args, func)
|
|
|
|
configobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
void (*func)(ALconfig, long);
|
|
|
|
{
|
|
|
|
long par;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_Parse (args, "l", &par)) return NULL;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
(*func) (self-> ob_config, par);
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
Py_INCREF (Py_None);
|
|
|
|
return Py_None;
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
getConfig (self, args, func)
|
|
|
|
configobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
long (*func)(ALconfig);
|
|
|
|
{
|
|
|
|
long par;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_NoArgs (args)) return NULL;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
par = (*func) (self-> ob_config);
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
return PyInt_FromLong (par);
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_setqueuesize (self, args)
|
|
|
|
configobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
|
|
|
return (setConfig (self, args, ALsetqueuesize));
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_getqueuesize (self, args)
|
|
|
|
configobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
|
|
|
return (getConfig (self, args, ALgetqueuesize));
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_setwidth (self, args)
|
|
|
|
configobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
|
|
|
return (setConfig (self, args, ALsetwidth));
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_getwidth (self, args)
|
|
|
|
configobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
|
|
|
return (getConfig (self, args, ALgetwidth));
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_getchannels (self, args)
|
|
|
|
configobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
|
|
|
return (getConfig (self, args, ALgetchannels));
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_setchannels (self, args)
|
|
|
|
configobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
|
|
|
return (setConfig (self, args, ALsetchannels));
|
|
|
|
}
|
|
|
|
|
1993-02-10 10:10:56 -04:00
|
|
|
#ifdef AL_405
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1993-02-10 10:10:56 -04:00
|
|
|
al_getsampfmt (self, args)
|
|
|
|
configobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1993-02-10 10:10:56 -04:00
|
|
|
{
|
|
|
|
return (getConfig (self, args, ALgetsampfmt));
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1993-02-10 10:10:56 -04:00
|
|
|
al_setsampfmt (self, args)
|
|
|
|
configobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1993-02-10 10:10:56 -04:00
|
|
|
{
|
|
|
|
return (setConfig (self, args, ALsetsampfmt));
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1993-02-10 10:10:56 -04:00
|
|
|
al_getfloatmax(self, args)
|
|
|
|
configobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1993-02-10 10:10:56 -04:00
|
|
|
{
|
|
|
|
double arg;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if ( !PyArg_NoArgs(args) )
|
1993-02-10 10:10:56 -04:00
|
|
|
return 0;
|
|
|
|
arg = ALgetfloatmax(self->ob_config);
|
1997-01-03 18:40:34 -04:00
|
|
|
return PyFloat_FromDouble(arg);
|
1993-02-10 10:10:56 -04:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1993-02-10 10:10:56 -04:00
|
|
|
al_setfloatmax(self, args)
|
|
|
|
configobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1993-02-10 10:10:56 -04:00
|
|
|
{
|
|
|
|
double arg;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if ( !PyArg_Parse(args, "d", &arg) )
|
1993-02-10 10:10:56 -04:00
|
|
|
return 0;
|
|
|
|
ALsetfloatmax(self->ob_config, arg);
|
1997-01-03 18:40:34 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1993-02-10 10:10:56 -04:00
|
|
|
}
|
|
|
|
#endif /* AL_405 */
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyMethodDef config_methods[] = {
|
|
|
|
{"getqueuesize", (PyCFunction)al_getqueuesize},
|
|
|
|
{"setqueuesize", (PyCFunction)al_setqueuesize},
|
|
|
|
{"getwidth", (PyCFunction)al_getwidth},
|
|
|
|
{"setwidth", (PyCFunction)al_setwidth},
|
|
|
|
{"getchannels", (PyCFunction)al_getchannels},
|
|
|
|
{"setchannels", (PyCFunction)al_setchannels},
|
1993-02-10 10:10:56 -04:00
|
|
|
#ifdef AL_405
|
1997-01-03 18:40:34 -04:00
|
|
|
{"getsampfmt", (PyCFunction)al_getsampfmt},
|
|
|
|
{"setsampfmt", (PyCFunction)al_setsampfmt},
|
|
|
|
{"getfloatmax", (PyCFunction)al_getfloatmax},
|
|
|
|
{"setfloatmax", (PyCFunction)al_setfloatmax},
|
1993-02-10 10:10:56 -04:00
|
|
|
#endif /* AL_405 */
|
1991-09-09 20:33:34 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
config_dealloc(self)
|
|
|
|
configobject *self;
|
|
|
|
{
|
|
|
|
ALfreeconfig(self->ob_config);
|
1997-01-03 18:40:34 -04:00
|
|
|
PyMem_DEL(self);
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
config_getattr(self, name)
|
|
|
|
configobject *self;
|
|
|
|
char *name;
|
|
|
|
{
|
1997-01-03 18:40:34 -04:00
|
|
|
return Py_FindMethod(config_methods, (PyObject *)self, name);
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyTypeObject Configtype = {
|
|
|
|
PyObject_HEAD_INIT(&PyType_Type)
|
1991-09-09 20:33:34 -03:00
|
|
|
0, /*ob_size*/
|
|
|
|
"config", /*tp_name*/
|
|
|
|
sizeof(configobject), /*tp_size*/
|
|
|
|
0, /*tp_itemsize*/
|
|
|
|
/* methods */
|
1994-08-01 08:34:53 -03:00
|
|
|
(destructor)config_dealloc, /*tp_dealloc*/
|
1991-09-09 20:33:34 -03:00
|
|
|
0, /*tp_print*/
|
1994-08-01 08:34:53 -03:00
|
|
|
(getattrfunc)config_getattr, /*tp_getattr*/
|
1991-09-09 20:33:34 -03:00
|
|
|
0, /*tp_setattr*/
|
|
|
|
0, /*tp_compare*/
|
|
|
|
0, /*tp_repr*/
|
|
|
|
};
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
newconfigobject(config)
|
|
|
|
ALconfig config;
|
|
|
|
{
|
|
|
|
configobject *p;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
p = PyObject_NEW(configobject, &Configtype);
|
1991-09-09 20:33:34 -03:00
|
|
|
if (p == NULL)
|
|
|
|
return NULL;
|
|
|
|
p->ob_config = config;
|
1997-01-03 18:40:34 -04:00
|
|
|
return (PyObject *)p;
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Port objects */
|
|
|
|
|
|
|
|
typedef struct {
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject_HEAD
|
1991-09-09 20:33:34 -03:00
|
|
|
ALport ob_port;
|
|
|
|
} portobject;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
staticforward PyTypeObject Porttype;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
#define is_portobject(v) ((v)->ob_type == &Porttype)
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_closeport (self, args)
|
|
|
|
portobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_NoArgs (args)) return NULL;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
if (self->ob_port != NULL) {
|
|
|
|
ALcloseport (self-> ob_port);
|
|
|
|
self->ob_port = NULL;
|
|
|
|
/* XXX Using a closed port may dump core! */
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
Py_INCREF (Py_None);
|
|
|
|
return Py_None;
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_getfd (self, args)
|
|
|
|
portobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_NoArgs (args)) return NULL;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
fd = ALgetfd (self-> ob_port);
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
return PyInt_FromLong (fd);
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_getfilled (self, args)
|
|
|
|
portobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
|
|
|
long count;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_NoArgs (args)) return NULL;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
count = ALgetfilled (self-> ob_port);
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
return PyInt_FromLong (count);
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_getfillable (self, args)
|
|
|
|
portobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
|
|
|
long count;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_NoArgs (args)) return NULL;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
count = ALgetfillable (self-> ob_port);
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
return PyInt_FromLong (count);
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_readsamps (self, args)
|
|
|
|
portobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
|
|
|
long count;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *v;
|
1991-09-10 11:54:05 -03:00
|
|
|
ALconfig c;
|
1991-09-09 20:33:34 -03:00
|
|
|
int width;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_Parse (args, "l", &count)) return NULL;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
if (count <= 0)
|
|
|
|
{
|
1997-01-03 18:40:34 -04:00
|
|
|
PyErr_SetString (PyExc_RuntimeError,
|
|
|
|
"al.readsamps : arg <= 0");
|
1991-09-09 20:33:34 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1991-09-10 11:54:05 -03:00
|
|
|
c = ALgetconfig(self->ob_port);
|
1993-02-10 10:10:56 -04:00
|
|
|
#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
|
1991-09-10 11:54:05 -03:00
|
|
|
width = ALgetwidth(c);
|
1993-02-10 10:10:56 -04:00
|
|
|
#endif /* AL_405 */
|
1991-09-10 11:54:05 -03:00
|
|
|
ALfreeconfig(c);
|
1997-01-03 18:40:34 -04:00
|
|
|
v = PyString_FromStringAndSize ((char *)NULL, width * count);
|
1991-09-09 20:33:34 -03:00
|
|
|
if (v == NULL) return NULL;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
|
|
|
ALreadsamps (self-> ob_port, (void *) PyString_AsString(v), count);
|
|
|
|
Py_END_ALLOW_THREADS
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
return (v);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_writesamps (self, args)
|
|
|
|
portobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
1992-01-27 12:45:55 -04:00
|
|
|
char *buf;
|
|
|
|
int size, width;
|
1991-09-10 11:54:05 -03:00
|
|
|
ALconfig c;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_Parse (args, "s#", &buf, &size)) return NULL;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
1991-09-10 11:54:05 -03:00
|
|
|
c = ALgetconfig(self->ob_port);
|
1993-02-10 10:10:56 -04:00
|
|
|
#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
|
1991-09-10 11:54:05 -03:00
|
|
|
width = ALgetwidth(c);
|
1993-02-10 10:10:56 -04:00
|
|
|
#endif /* AL_405 */
|
1991-09-10 11:54:05 -03:00
|
|
|
ALfreeconfig(c);
|
1997-01-03 18:40:34 -04:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
1992-01-27 12:45:55 -04:00
|
|
|
ALwritesamps (self-> ob_port, (void *) buf, (long) size / width);
|
1997-01-03 18:40:34 -04:00
|
|
|
Py_END_ALLOW_THREADS
|
1991-09-09 20:33:34 -03:00
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
Py_INCREF (Py_None);
|
|
|
|
return Py_None;
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_getfillpoint (self, args)
|
|
|
|
portobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
|
|
|
long count;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_NoArgs (args)) return NULL;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
count = ALgetfillpoint (self-> ob_port);
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
return PyInt_FromLong (count);
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_setfillpoint (self, args)
|
|
|
|
portobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
|
|
|
long count;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_Parse (args, "l", &count)) return NULL;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
ALsetfillpoint (self-> ob_port, count);
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
Py_INCREF (Py_None);
|
|
|
|
return (Py_None);
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_setconfig (self, args)
|
|
|
|
portobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
|
|
|
ALconfig config;
|
|
|
|
|
1992-01-27 12:45:55 -04:00
|
|
|
if (!getconfigarg (args, &config)) return NULL;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
ALsetconfig (self-> ob_port, config);
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
Py_INCREF (Py_None);
|
|
|
|
return (Py_None);
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_getconfig (self, args)
|
|
|
|
portobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
|
|
|
ALconfig config;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_NoArgs (args)) return NULL;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
config = ALgetconfig (self-> ob_port);
|
|
|
|
|
|
|
|
return newconfigobject (config);
|
|
|
|
}
|
|
|
|
|
1993-02-10 10:10:56 -04:00
|
|
|
#ifdef AL_405
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1993-02-10 10:10:56 -04:00
|
|
|
al_getstatus (self, args)
|
|
|
|
portobject *self;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1993-02-10 10:10:56 -04:00
|
|
|
{
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *list, *v;
|
1993-02-10 10:10:56 -04:00
|
|
|
long *PVbuffer;
|
|
|
|
long length;
|
|
|
|
int i;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_Parse(args, "O", &list))
|
1993-02-10 10:10:56 -04:00
|
|
|
return NULL;
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyList_Check(list)) {
|
|
|
|
PyErr_BadArgument();
|
1993-02-10 10:10:56 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-01-03 18:40:34 -04:00
|
|
|
length = PyList_Size(list);
|
|
|
|
PVbuffer = PyMem_NEW(long, length);
|
1993-02-10 10:10:56 -04:00
|
|
|
if (PVbuffer == NULL)
|
1997-01-03 18:40:34 -04:00
|
|
|
return PyErr_NoMemory();
|
1993-02-10 10:10:56 -04:00
|
|
|
for (i = 0; i < length; i++) {
|
1997-01-03 18:40:34 -04:00
|
|
|
v = PyList_GetItem(list, i);
|
|
|
|
if (!PyInt_Check(v)) {
|
|
|
|
PyMem_DEL(PVbuffer);
|
|
|
|
PyErr_BadArgument();
|
1993-02-10 10:10:56 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-01-03 18:40:34 -04:00
|
|
|
PVbuffer[i] = PyInt_AsLong(v);
|
1993-02-10 10:10:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
ALgetstatus(self->ob_port, PVbuffer, length);
|
|
|
|
|
|
|
|
for (i = 0; i < length; i++)
|
1997-01-03 18:40:34 -04:00
|
|
|
PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i]));
|
1993-02-10 10:10:56 -04:00
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
PyMem_DEL(PVbuffer);
|
1993-02-10 10:10:56 -04:00
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1993-02-10 10:10:56 -04:00
|
|
|
}
|
|
|
|
#endif /* AL_405 */
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyMethodDef port_methods[] = {
|
|
|
|
{"closeport", (PyCFunction)al_closeport},
|
|
|
|
{"getfd", (PyCFunction)al_getfd},
|
|
|
|
{"fileno", (PyCFunction)al_getfd},
|
|
|
|
{"getfilled", (PyCFunction)al_getfilled},
|
|
|
|
{"getfillable", (PyCFunction)al_getfillable},
|
|
|
|
{"readsamps", (PyCFunction)al_readsamps},
|
|
|
|
{"writesamps", (PyCFunction)al_writesamps},
|
|
|
|
{"setfillpoint", (PyCFunction)al_setfillpoint},
|
|
|
|
{"getfillpoint", (PyCFunction)al_getfillpoint},
|
|
|
|
{"setconfig", (PyCFunction)al_setconfig},
|
|
|
|
{"getconfig", (PyCFunction)al_getconfig},
|
1993-02-10 10:10:56 -04:00
|
|
|
#ifdef AL_405
|
1997-01-03 18:40:34 -04:00
|
|
|
{"getstatus", (PyCFunction)al_getstatus},
|
1993-02-10 10:10:56 -04:00
|
|
|
#endif /* AL_405 */
|
1991-09-09 20:33:34 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
port_dealloc(p)
|
|
|
|
portobject *p;
|
|
|
|
{
|
|
|
|
if (p->ob_port != NULL)
|
|
|
|
ALcloseport(p->ob_port);
|
1997-01-03 18:40:34 -04:00
|
|
|
PyMem_DEL(p);
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
port_getattr(p, name)
|
|
|
|
portobject *p;
|
|
|
|
char *name;
|
|
|
|
{
|
1997-01-03 18:40:34 -04:00
|
|
|
return Py_FindMethod(port_methods, (PyObject *)p, name);
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyTypeObject Porttype = {
|
|
|
|
PyObject_HEAD_INIT(&PyType_Type)
|
1991-09-09 20:33:34 -03:00
|
|
|
0, /*ob_size*/
|
|
|
|
"port", /*tp_name*/
|
|
|
|
sizeof(portobject), /*tp_size*/
|
|
|
|
0, /*tp_itemsize*/
|
|
|
|
/* methods */
|
1994-08-01 08:34:53 -03:00
|
|
|
(destructor)port_dealloc, /*tp_dealloc*/
|
1991-09-09 20:33:34 -03:00
|
|
|
0, /*tp_print*/
|
1994-08-01 08:34:53 -03:00
|
|
|
(getattrfunc)port_getattr, /*tp_getattr*/
|
1991-09-09 20:33:34 -03:00
|
|
|
0, /*tp_setattr*/
|
|
|
|
0, /*tp_compare*/
|
|
|
|
0, /*tp_repr*/
|
|
|
|
};
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
newportobject(port)
|
|
|
|
ALport port;
|
|
|
|
{
|
|
|
|
portobject *p;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
p = PyObject_NEW(portobject, &Porttype);
|
1991-09-09 20:33:34 -03:00
|
|
|
if (p == NULL)
|
|
|
|
return NULL;
|
|
|
|
p->ob_port = port;
|
1997-01-03 18:40:34 -04:00
|
|
|
return (PyObject *)p;
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* the module al */
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_openport (self, args)
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *self, *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
1992-01-27 12:45:55 -04:00
|
|
|
char *name, *dir;
|
1991-09-09 20:33:34 -03:00
|
|
|
ALport port;
|
|
|
|
ALconfig config = NULL;
|
1991-10-20 17:10:46 -03:00
|
|
|
int size;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if (args == NULL || !PyTuple_Check(args)) {
|
|
|
|
PyErr_BadArgument ();
|
1991-10-20 17:10:46 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-01-03 18:40:34 -04:00
|
|
|
size = PyTuple_Size(args);
|
1991-09-09 20:33:34 -03:00
|
|
|
if (size == 2) {
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_Parse (args, "(ss)", &name, &dir))
|
1991-09-09 20:33:34 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
else if (size == 3) {
|
|
|
|
if (!getstrstrconfigarg (args, &name, &dir, &config))
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
else {
|
1997-01-03 18:40:34 -04:00
|
|
|
PyErr_BadArgument ();
|
1991-09-09 20:33:34 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1992-01-27 12:45:55 -04:00
|
|
|
port = ALopenport(name, dir, config);
|
1991-09-09 20:33:34 -03:00
|
|
|
|
1991-10-20 17:10:46 -03:00
|
|
|
if (port == NULL) {
|
1997-01-03 18:40:34 -04:00
|
|
|
PyErr_SetFromErrno(PyExc_RuntimeError);
|
1991-10-20 17:10:46 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1991-09-09 20:33:34 -03:00
|
|
|
return newportobject (port);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-09 20:33:34 -03:00
|
|
|
al_newconfig (self, args)
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *self, *args;
|
1991-09-09 20:33:34 -03:00
|
|
|
{
|
|
|
|
ALconfig config;
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_NoArgs (args)) return NULL;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
config = ALnewconfig ();
|
1991-10-20 17:10:46 -03:00
|
|
|
if (config == NULL) {
|
1997-01-03 18:40:34 -04:00
|
|
|
PyErr_SetFromErrno(PyExc_RuntimeError);
|
1991-10-20 17:10:46 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
return newconfigobject (config);
|
|
|
|
}
|
1991-09-10 11:54:05 -03:00
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-10 11:54:05 -03:00
|
|
|
al_queryparams(self, args)
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *self, *args;
|
1991-09-10 11:54:05 -03:00
|
|
|
{
|
|
|
|
long device;
|
|
|
|
long length;
|
|
|
|
long *PVbuffer;
|
|
|
|
long PVdummy[2];
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *v;
|
1991-09-10 11:54:05 -03:00
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_Parse (args, "l", &device))
|
1991-09-10 11:54:05 -03:00
|
|
|
return NULL;
|
|
|
|
length = ALqueryparams(device, PVdummy, 2L);
|
1997-01-03 18:40:34 -04:00
|
|
|
PVbuffer = PyMem_NEW(long, length);
|
1991-09-10 11:54:05 -03:00
|
|
|
if (PVbuffer == NULL)
|
1997-01-03 18:40:34 -04:00
|
|
|
return PyErr_NoMemory();
|
1991-09-10 11:54:05 -03:00
|
|
|
(void) ALqueryparams(device, PVbuffer, length);
|
1997-01-03 18:40:34 -04:00
|
|
|
v = PyList_New((int)length);
|
1991-09-10 11:54:05 -03:00
|
|
|
if (v != NULL) {
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < length; i++)
|
1997-01-03 18:40:34 -04:00
|
|
|
PyList_SetItem(v, i, PyInt_FromLong(PVbuffer[i]));
|
1991-09-10 11:54:05 -03:00
|
|
|
}
|
1997-01-03 18:40:34 -04:00
|
|
|
PyMem_DEL(PVbuffer);
|
1991-09-10 11:54:05 -03:00
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-10 11:54:05 -03:00
|
|
|
doParams(args, func, modified)
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *args;
|
1991-09-10 11:54:05 -03:00
|
|
|
void (*func)(long, long *, long);
|
|
|
|
int modified;
|
|
|
|
{
|
|
|
|
long device;
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *list, *v;
|
1991-09-10 11:54:05 -03:00
|
|
|
long *PVbuffer;
|
|
|
|
long length;
|
|
|
|
int i;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_Parse(args, "(lO)", &device, &list))
|
1991-09-10 11:54:05 -03:00
|
|
|
return NULL;
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyList_Check(list)) {
|
|
|
|
PyErr_BadArgument();
|
1991-09-10 11:54:05 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-01-03 18:40:34 -04:00
|
|
|
length = PyList_Size(list);
|
|
|
|
PVbuffer = PyMem_NEW(long, length);
|
1991-09-10 11:54:05 -03:00
|
|
|
if (PVbuffer == NULL)
|
1997-01-03 18:40:34 -04:00
|
|
|
return PyErr_NoMemory();
|
1991-09-10 11:54:05 -03:00
|
|
|
for (i = 0; i < length; i++) {
|
1997-01-03 18:40:34 -04:00
|
|
|
v = PyList_GetItem(list, i);
|
|
|
|
if (!PyInt_Check(v)) {
|
|
|
|
PyMem_DEL(PVbuffer);
|
|
|
|
PyErr_BadArgument();
|
1991-09-10 11:54:05 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-01-03 18:40:34 -04:00
|
|
|
PVbuffer[i] = PyInt_AsLong(v);
|
1991-09-10 11:54:05 -03:00
|
|
|
}
|
|
|
|
|
1991-09-13 12:31:47 -03:00
|
|
|
(*func)(device, PVbuffer, length);
|
1991-09-10 11:54:05 -03:00
|
|
|
|
|
|
|
if (modified) {
|
|
|
|
for (i = 0; i < length; i++)
|
1997-01-03 18:40:34 -04:00
|
|
|
PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i]));
|
1991-09-10 11:54:05 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
PyMem_DEL(PVbuffer);
|
1991-10-20 17:10:46 -03:00
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-09-10 11:54:05 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-10 11:54:05 -03:00
|
|
|
al_getparams(self, args)
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *self, *args;
|
1991-09-10 11:54:05 -03:00
|
|
|
{
|
|
|
|
return doParams(args, ALgetparams, 1);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1991-09-10 11:54:05 -03:00
|
|
|
al_setparams(self, args)
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *self, *args;
|
1991-09-10 11:54:05 -03:00
|
|
|
{
|
|
|
|
return doParams(args, ALsetparams, 0);
|
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1992-08-19 13:41:15 -03:00
|
|
|
al_getname(self, args)
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *self, *args;
|
1992-08-19 13:41:15 -03:00
|
|
|
{
|
|
|
|
long device, descriptor;
|
|
|
|
char *name;
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_Parse(args, "(ll)", &device, &descriptor))
|
1992-08-19 13:41:15 -03:00
|
|
|
return NULL;
|
|
|
|
name = ALgetname(device, descriptor);
|
|
|
|
if (name == NULL) {
|
1997-01-03 18:40:34 -04:00
|
|
|
PyErr_SetString(PyExc_ValueError,
|
|
|
|
"al.getname: bad descriptor");
|
1992-08-19 13:41:15 -03:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-01-03 18:40:34 -04:00
|
|
|
return PyString_FromString(name);
|
1992-08-19 13:41:15 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1992-08-19 13:41:15 -03:00
|
|
|
al_getdefault(self, args)
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *self, *args;
|
1992-08-19 13:41:15 -03:00
|
|
|
{
|
|
|
|
long device, descriptor, value;
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_Parse(args, "(ll)", &device, &descriptor))
|
1992-08-19 13:41:15 -03:00
|
|
|
return NULL;
|
|
|
|
value = ALgetdefault(device, descriptor);
|
1997-01-03 18:40:34 -04:00
|
|
|
return PyLong_FromLong(value);
|
1992-08-19 13:41:15 -03:00
|
|
|
}
|
|
|
|
|
1997-01-03 18:40:34 -04:00
|
|
|
static PyObject *
|
1992-08-19 13:41:15 -03:00
|
|
|
al_getminmax(self, args)
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *self, *args;
|
1992-08-19 13:41:15 -03:00
|
|
|
{
|
|
|
|
long device, descriptor, min, max;
|
1997-01-03 18:40:34 -04:00
|
|
|
if (!PyArg_Parse(args, "(ll)", &device, &descriptor))
|
1992-08-19 13:41:15 -03:00
|
|
|
return NULL;
|
|
|
|
min = -1;
|
|
|
|
max = -1;
|
|
|
|
ALgetminmax(device, descriptor, &min, &max);
|
1997-01-03 18:40:34 -04:00
|
|
|
return Py_BuildValue("ll", min, max);
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyMethodDef al_methods[] = {
|
|
|
|
{"openport", (PyCFunction)al_openport},
|
|
|
|
{"newconfig", (PyCFunction)al_newconfig},
|
|
|
|
{"queryparams", (PyCFunction)al_queryparams},
|
|
|
|
{"getparams", (PyCFunction)al_getparams},
|
|
|
|
{"setparams", (PyCFunction)al_setparams},
|
|
|
|
{"getname", (PyCFunction)al_getname},
|
|
|
|
{"getdefault", (PyCFunction)al_getdefault},
|
|
|
|
{"getminmax", (PyCFunction)al_getminmax},
|
1991-09-09 20:33:34 -03:00
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
inital()
|
|
|
|
{
|
1997-01-03 18:40:34 -04:00
|
|
|
Py_InitModule("al", al_methods);
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
|
|
|
|
1992-01-27 12:45:55 -04:00
|
|
|
static int
|
|
|
|
getconfigarg(o, conf)
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *o;
|
1991-09-09 20:33:34 -03:00
|
|
|
ALconfig *conf;
|
|
|
|
{
|
|
|
|
if (o == NULL || !is_configobject(o))
|
1997-01-03 18:40:34 -04:00
|
|
|
return PyErr_BadArgument ();
|
1991-09-09 20:33:34 -03:00
|
|
|
|
1992-01-27 12:45:55 -04:00
|
|
|
*conf = ((configobject *) o) -> ob_config;
|
1991-09-09 20:33:34 -03:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
1992-01-27 12:45:55 -04:00
|
|
|
static int
|
1991-09-09 20:33:34 -03:00
|
|
|
getstrstrconfigarg(v, a, b, c)
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *v;
|
1992-01-27 12:45:55 -04:00
|
|
|
char **a;
|
|
|
|
char **b;
|
1991-09-09 20:33:34 -03:00
|
|
|
ALconfig *c;
|
|
|
|
{
|
1997-01-03 18:40:34 -04:00
|
|
|
PyObject *o;
|
|
|
|
return PyArg_Parse(v, "(ssO)", a, b, &o) && getconfigarg(o, c);
|
1991-09-09 20:33:34 -03:00
|
|
|
}
|
1997-01-03 18:40:34 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|