From: John McCabe on 8 Mar 2010 07:30 On Mon, 8 Mar 2010 03:52:04 -0800 (PST), Gautier write-only <gautier_niouzes(a)hotmail.com> wrote: >Probably the most urgent thing is to make a package called MIDI, in >the body of which you hide all the Win32 / C things. >More precisely: >- hide the Win32 references >- use the C strings only in midi.adb >- define constants, when possible, enumerated types which match >Win32's >Otherwise your code will grow into something very, very messy (check >AdaGIDE's sources as the example of what to be avoided). Oh - of course. Those things would be the next step. This is just a little noddy thing to get an idea of how to use it. For what it's worth though, I've already got loads of examples of what should be avoided :-}
From: John McCabe on 9 Mar 2010 09:00 On Tue, 9 Mar 2010 05:11:25 -0800 (PST), Martin <martin.dowie(a)btopenworld.com> wrote: >On Mar 9, 12:24�pm, John McCabe <j...(a)nospam.assen.demon.co.uk> wrote: >> On Tue, 09 Mar 2010 10:21:00 +0000, John McCabe >> >> <j...(a)nospam.assen.demon.co.uk> wrote: >> >>I would make Numinputdevices and Numoutputdevices constants. >> >They're not constants though - they're discovered from the >> >midiInGetNumDevs and midiOutGetnumDevs functions. >> >> Just realised what you mean; they're constant through the life of the >> program so do >> >> procedure MidiDevs is >> � �blah >> >> � �Num_Input_Devices : Win32.UINT := Win32.Mmsystem.midiInGetNumDevs; >> � �<same for output> >> begin >> >> � �blah >> >> end MidiDevs; >> >> Yes, that would be possible. > >Better yet: > Num_Input_Devices : constant Win32.UINT := >Win32.Mmsystem.midiInGetNumDevs; Aaarrrggh - of course! The things that happen when you rush to type something :-)
|
Pages: 1 Prev: Trouble cutting loops with SPARK. Advice? Next: TIOBE index |