mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	added getname, getdefault and getminmax functions
This commit is contained in:
		
							parent
							
								
									2b81dc9c00
								
							
						
					
					
						commit
						448f4bf45a
					
				
					 1 changed files with 43 additions and 0 deletions
				
			
		| 
						 | 
					@ -566,12 +566,55 @@ al_setparams(self, args)
 | 
				
			||||||
	return doParams(args, ALsetparams, 0);
 | 
						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[] = {
 | 
					static struct methodlist al_methods[] = {
 | 
				
			||||||
	{"openport",		al_openport},
 | 
						{"openport",		al_openport},
 | 
				
			||||||
	{"newconfig",		al_newconfig},
 | 
						{"newconfig",		al_newconfig},
 | 
				
			||||||
	{"queryparams",		al_queryparams},
 | 
						{"queryparams",		al_queryparams},
 | 
				
			||||||
	{"getparams",		al_getparams},
 | 
						{"getparams",		al_getparams},
 | 
				
			||||||
	{"setparams",		al_setparams},
 | 
						{"setparams",		al_setparams},
 | 
				
			||||||
 | 
						{"getname",		al_getname},
 | 
				
			||||||
 | 
						{"getdefault",		al_getdefault},
 | 
				
			||||||
 | 
						{"getminmax",		al_getminmax},
 | 
				
			||||||
	{NULL,			NULL}		/* sentinel */
 | 
						{NULL,			NULL}		/* sentinel */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue