added getname, getdefault and getminmax functions

This commit is contained in:
Guido van Rossum 1992-08-19 16:41:15 +00:00
parent 2b81dc9c00
commit 448f4bf45a
1 changed files with 43 additions and 0 deletions

View File

@ -566,12 +566,55 @@ al_setparams(self, args)
return doParams(args, ALsetparams, 0);
}
static object *
al_getname(self, args)
object *self, *args;
{
long device, descriptor;
char *name;
if (!getargs(args, "(ll)", &device, &descriptor))
return NULL;
name = ALgetname(device, descriptor);
if (name == NULL) {
err_setstr(ValueError, "al.getname: bad descriptor");
return NULL;
}
return newstringobject(name);
}
static object *
al_getdefault(self, args)
object *self, *args;
{
long device, descriptor, value;
if (!getargs(args, "(ll)", &device, &descriptor))
return NULL;
value = ALgetdefault(device, descriptor);
return newlongobject(value);
}
static object *
al_getminmax(self, args)
object *self, *args;
{
long device, descriptor, min, max;
if (!getargs(args, "(ll)", &device, &descriptor))
return NULL;
min = -1;
max = -1;
ALgetminmax(device, descriptor, &min, &max);
return mkvalue("ll", min, max);
}
static struct methodlist al_methods[] = {
{"openport", al_openport},
{"newconfig", al_newconfig},
{"queryparams", al_queryparams},
{"getparams", al_getparams},
{"setparams", al_setparams},
{"getname", al_getname},
{"getdefault", al_getdefault},
{"getminmax", al_getminmax},
{NULL, NULL} /* sentinel */
};