diff options
author | Guido van Rossum <guido@python.org> | 1992-08-19 16:41:15 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1992-08-19 16:41:15 (GMT) |
commit | 448f4bf45a3005023770133666a504eab5e4648f (patch) | |
tree | 9616ca58b171c0736ecc3fa32e436d0e3b210f87 /Modules/almodule.c | |
parent | 2b81dc9c00f5000fd5c1c9aac8b666ccc7f0a1a6 (diff) | |
download | cpython-448f4bf45a3005023770133666a504eab5e4648f.zip cpython-448f4bf45a3005023770133666a504eab5e4648f.tar.gz cpython-448f4bf45a3005023770133666a504eab5e4648f.tar.bz2 |
added getname, getdefault and getminmax functions
Diffstat (limited to 'Modules/almodule.c')
-rw-r--r-- | Modules/almodule.c | 43 |
1 files changed, 43 insertions, 0 deletions
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 */ }; |