From 448f4bf45a3005023770133666a504eab5e4648f Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 19 Aug 1992 16:41:15 +0000 Subject: added getname, getdefault and getminmax functions --- Modules/almodule.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/Modules/almodule.c b/Modules/almodule.c index 044baae..6b1dde3 100644 --- a/Modules/almodule.c +++ b/Modules/almodule.c @@ -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 */ }; -- cgit v0.12