comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Preprocessor functionality equivalent ideas needed
Date: 12 Dec 2003 05:52:32 +0000
Date: 2003-12-12T05:52:32+00:00	[thread overview]
Message-ID: <x7voeue1t27.fsf@smaug.pushface.org> (raw)
In-Reply-To: br86p2$jum$1@a1-hrz.uni-duisburg.de

Georg Bauhaus <sb463ba@l1-hrz.uni-duisburg.de> writes:

> There are two more ways I know of, one uses generics for listing
> the configuration-specific things that your program needs. The other
> uses tagged types, that is O-O types. Again for OSs,
> 
> generic
>    type OS is private;
> 
>    with function available_disk_space (op_sys: OS) return Natural;
>    --  free blocks
> 
> package System_Dependent is
>    procedure Installation_Setup;
>    procedure Unpack;
> end System_Dependent;
> 
> If you now write
> 
> with BSD;
> package Everywhere_Working_Installation is
>   new Specifics (available_disk_space => BSD.free_blocks_count);
> 
> you can use the procedures in package Everywhere_Working_Installation
> in your program.

A technique we've found handy is an extension of the "generic
signature package" idea, for use when your code won't be written in a
generic:

generic
   with procedure Actual_P (I : Integer);
   with function Actual_Q return Boolean;
package Signature is
   procedure P (I : Integer) renames Actual_P;
   function Q return Boolean renames Actual_Q;
end Signature;

That way you don't have to use the names P, Q in the actual package
(indeed, the actual subprograms could come from more than one
package).

-- 
Simon Wright                               100% Ada, no bugs.



  reply	other threads:[~2003-12-12  5:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-10 20:04 Preprocessor functionality equivalent ideas needed Greg Milford
2003-12-10 21:41 ` Ludovic Brenta
2003-12-11 17:12   ` sed and perl - yuck [Was Re: Preprocessor functionality equivalent ideas needed] Martin Krischik
2003-12-16  0:40     ` Waldek Hebisch
2003-12-16 20:52       ` Martin Krischik
2003-12-10 22:29 ` Preprocessor functionality equivalent ideas needed Georg Bauhaus
2003-12-12  5:52   ` Simon Wright [this message]
2003-12-11  1:07 ` Jeffrey Carter
2003-12-11 13:34   ` Marin David Condic
2003-12-11 17:49     ` Jeffrey Carter
2003-12-11  5:39 ` Steve
2003-12-11 16:59 ` Martin Krischik
  -- strict thread matches above, loose matches on Subject: below --
2003-12-11 12:52 Lionel.DRAGHI
2003-12-11 15:51 Lionel.DRAGHI
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox