On Thu, 31 Jan 2008, Aldrin Martoq wrote: > Hey hackers, > > While developing pyalsa sequencer API, I found that sometimes 0 is > used instead of a #defined value or constant. > > In my opinion, given that the alsa API is opaque (hides internal > structure and provides methods for accessing them), we should define > those missing "constants" for being consistent. So far I found: > SND_SEQ_BLOCK 0 (blocking mode) > SND_SEQ_PORT_CAP_NONE (the port defines no access capabilites) Note that SND_SEQ_NONBLOCK is flag (bitmask). Also SND_SEQ_PORT_CAP_* defines are bitmasks. I don't see usage to have defined for 0 because it always mean "off state" rather than a direct value. Correct tests are: val&SND_SEQ_NONBLOCK - nonblocking behaviour (val&SND_SEQ_NONBLOCK)==0 - blocking behaviour Regarding python. I think that we need to settle naming scheme. I just moved my code to follow standard python rules (only class names have upper letters and constants). I also chose a different organization for constants in my code to have possibility to enumerate all related bitmasks or numbers using dictionaries. See my python modules. It meas to define SEQ_ADDRESS_* like: seq_address = {'BROADCAST': 0xff, 'SUBSCRIBERS': 0xfe, 'UNKNOWN': 0xfd} open_mode = {'NONBLOCK': 1} etc... Jaroslav ----- Jaroslav Kysela <perex@xxxxxxxx> Linux Kernel Sound Maintainer ALSA Project, Red Hat, Inc. _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel