comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <sb463ba@l1-hrz.uni-duisburg.de>
Subject: Re: Attributes 'Version and 'Body_Version
Date: Tue, 27 Nov 2001 17:04:01 +0000 (UTC)
Date: 2001-11-27T17:04:01+00:00	[thread overview]
Message-ID: <9u0h21$d1d$1@a1-hrz.uni-duisburg.de> (raw)
In-Reply-To: 9tu7nj$4v9lc$1@ID-25716.news.dfncis.de

Nick Roberts (:) and Robert Dewar debate:

:> There is no point in using the same attribute
:> name for two different purposes.
: 
: Yes there is: simplicity.
 
:> > Far be it from me to wish to perpetuate any confusion,
 
:> You can cure someones confusion with documentation [iff...]
 
I find the level of confusion in the thread unsatisfying,
in that it is at most at O(1). So let me add some loosely
related 2c. Or make that 2 centimes belgique :-)


package Versions is
   -- provide versions at run time, for a change, or maybe not

   type Version is
     -- to be attached to objects
      record
	 Version: Natural;
	 --  XXX provide a decent Version type instead of a Natural
	 -- type for versions
      end record;

   type Versioned_Versions is (Versi_On, Versi_Off);
   --  for toggling versioned versions of Version objects
   -- See Version below.

   procedure Which_Version(Want_Versioned_Version: Versioned_Versions);
   --  toggle versioning feature

   generic
      Max_Version: in Natural;
      --  no more than this number of Versions

   package Versioning is

      function Version (V: Version) return Version;
      --  versions V such that Version V has a Versions.Version iff this feature
      -- has been turned on with Version (See Version above above).

   end Versioning;

end Versions;


package body Versions is

   VV: Versioned_Versions:= Versi_Off;
   --  modus operandi

   -- ----------------
   -- Which_Version
   -- ----------------
   --  adjust the state variable VV to have the same value as
   -- Want_Versioned_Version

   procedure Which_Version(Want_Versioned_Version: Versioned_Versions) is
   begin
      VV:= Want_Versioned_Version;
   end Which_Version;



   package body Versioning is

      protected Versigen is
         --  new version numbers are assigned here up
         --  to a limit XXX remove the limit

         entry Next;
         -- can't proceed when no more versioning could
         -- possibly be done  XXX Add Free(Ver: Natural)
         -- (No, neither free the storage, nor Free the storage)

         function Current return Natural;

      private
         Ver: Natural:= 0;
      end Versigen;


      protected body Versigen is

         entry Next when Ver < Max_Version is
         begin
            Ver:= Natural'Succ(Ver);
         end Next;

         function Current return Natural is
         begin
            return Ver;
         end Current;

      end Versigen;



      -------------
      -- Version --
      -------------

      function Version (V: Versions.Version) return Versions.Version is
         Result: Versions.Version;

      begin
         if VV = Versi_On then

        Want_Versioning:
            declare
               Wanted_Version: Natural;
            begin
               Versigen.Next;
               Wanted_Version:= Versigen.Current;

               Result:= (Version => Wanted_Version);
            end Want_Versioning;

         else  --  Versi_off

            Result:= V;
         end if;

         return Result;
      end Version;

   end Versioning;

end Versions;




      parent reply	other threads:[~2001-11-27 17:04 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-06 20:58 Attributes 'Version and 'Body_Version Marin David Condic
2001-11-07  3:39 ` Robert Dewar
2001-11-07 15:08   ` Marin David Condic
2001-11-07 20:51   ` Tony Gair
2001-11-07 16:45     ` Marin David Condic
2001-11-07 18:32       ` Vincent Marciante
2001-11-07 19:00         ` Marin David Condic
2001-11-07 23:11           ` Robert Dewar
2001-11-08 17:28             ` Stephen Leake
2001-11-08 17:43               ` Larry Kilgallen
2001-11-08 19:03                 ` Marin David Condic
2001-11-08 19:37                   ` Larry Kilgallen
2001-11-09  3:50                   ` Robert Dewar
2001-11-09  3:55                   ` Robert Dewar
2001-11-08 18:55             ` Marin David Condic
2001-11-07 19:54       ` Larry Kilgallen
2001-11-07 21:49         ` Marin David Condic
2001-11-07 23:08     ` Robert Dewar
2001-11-07 22:04 ` Keith Thompson
2001-11-08 16:34   ` Frank
2001-11-09  3:53   ` Robert Dewar
2001-11-10  0:07     ` Keith Thompson
2001-11-10  2:16       ` Larry Kilgallen
2001-11-11 15:18         ` Marin David Condic
2001-11-12 23:06           ` Tony Gair
2001-11-12 21:51       ` Robert Dewar
2001-11-13  8:07         ` Keith Thompson
2001-11-25 20:49           ` Nick Roberts
2001-11-26  2:30             ` Robert Dewar
2001-11-26  3:31               ` Nick Roberts
2001-11-26 15:42                 ` Robert Dewar
2001-11-26 20:05                   ` Nick Roberts
2001-11-27  3:56                     ` Robert Dewar
2001-11-27 17:51                       ` Nick Roberts
2001-11-28  0:44                       ` Larry Kilgallen
2001-11-28 15:49                         ` Robert Dewar
2001-11-28 16:53                         ` Larry Kilgallen
     [not found]                         ` <5ee5b646.0111280749.77fabe6c@posting.google.coOrganization: LJK Software <PFcoNrf74AeG@eisner.encompasserve.org>
2001-11-29  3:49                           ` Robert Dewar
2001-11-29 11:52                           ` Larry Kilgallen
     [not found]                           ` <5ee5b646.0111Organization: LJK Software <Kg7U2sTGDFyI@eisner.encompasserve.org>
2001-11-30  2:26                             ` Robert Dewar
2001-11-30  2:55                               ` Larry Kilgallen
2001-11-27 17:04                     ` Georg Bauhaus [this message]
replies disabled

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