Prev: Presentations on-line - Ada&SPARK for Education&Research
Next: Thinking of using Ada for a job at home. Couple of questionsfirst.
From: Dmitry A. Kazakov on 3 Mar 2010 17:20 On Wed, 03 Mar 2010 20:38:01 +0000, John McCabe wrote: > As for the tagged Connection type, I'm not sure what you mean. Would > you mind elaborating on that please? I meant something like this: type Abstract_Connection is tagged ...; procedure On_XYZ (Link : in out Connection) is abstract; .... task type Driver (Link : not null access Abstract_Connection'Class); task body Driver is begin loop -- read a message (could be polymorphic or not) ... -- process the message (usually polymorphic) case ... is when XYZ => -- XYZ is here Link.On_XYZ; -- Do what has to be done when ... => ... end case; end loop; exception when Shut_Down_Exception => null; when Error : others => Put ("I am dead! " & Exception_Information (Error)); end Driver; type My_Fancy_MIDI_Connection is new Abstract_Connection with private; overriding procedure On_XYZ (Link : in out My_Fancy_MIDI_Connection); .... I usually have a driver task which deals with a class-wide Connection object that implements the lower-level communication protocol (the part that reads messages) and the higher-level semantic call-backs (the part that reacts to the messages read). If the communication library is built on callbacks (i.e. already has a hidden Driver task), then I pass the connection object as user parameter to the callback, and the loop body above is what to be done in the callback routine. The advantage of having Connection tagged is that I can implement layered protocols and semantic actions incrementally. In complex cases I add further mix-ins as access discrimnants to Connection, usually when I need to make lower layers pluggable. But that would be over the top in your case. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
From: John McCabe on 4 Mar 2010 06:39 On Thu, 04 Mar 2010 07:22:34 +0100, Hibou57 (Yannick Duch�ne) <yannick_duchene(a)yahoo.fr> wrote: >Le Wed, 03 Mar 2010 21:17:12 +0100, John McCabe ><john(a)nospam.assen.demon.co.uk.nospam> a �crit: >> I've found a library >> called libjdkmidi that, if it would look easier to bind to than direct >> to Win32's mmsystem functions, might be worth doing. >Keep in mind it's a C++ library, not Ada Of course, as otherwise I wouldn't need to bind to it!
From: Pascal Obry on 10 Mar 2010 16:00
Simon, > My work project is using a (rather old) GNATpro with Cygwin, also rather > old; the only issue was to do with cyggnat.dll vs cygwin.dll vs gdb, and > it was simply a matter of copying the right one to the right place as > per AdaCore's instructions. I don't know what the current position is. The cygnat.dll was used for gdb. The recent GNAT versions come with a MingW based version of GDB. So there is no more cygwin in GNAT package. I'm still using Cygwin to get a decent shell on Windows plus sshd and cron. Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net - http://v2p.fr.eu.org --| "The best way to travel is by means of imagination" --| --| gpg --keyserver keys.gnupg.net --recv-key F949BD3B |