comp.lang.ada
 help / color / mirror / Atom feed
From: Vincent Marciante <marciant@li.net>
Subject: Re: calander package
Date: Tue, 13 Mar 2001 21:04:02 -0500
Date: 2001-03-13T21:04:02-05:00	[thread overview]
Message-ID: <3AAED192.1479@li.net> (raw)
In-Reply-To: nAwr6.4569$7e6.1762378@homer.alpha.net

Randy Brukardt wrote:
> 
> 
> I was thinking about proposing something on this line to the ARG for
> standardization, but it unclear that the ARG is interested in
> (semi-)standardizing these sorts of packages. (It seems to run about
> 50-50 within the membership as to whether time should be spent on it.
> The objections mostly are that there are more important things to work
> on.)
> 
>                 Randy Brukardt.

The original Booch.Calendar_Utilities could be considered.

http://www.adapower.com/original_booch/

Its spec follows.

Vinny


--    Original Booch Components (Ada 95 elaboration version)
-- Copyright (C) 2000 Grady Booch, provided WITHOUT ANY WARRANTY.
-- Further license details should appear at the end of this file.

with Calendar;
package Booch.Calendar_Utilities is
pragma Elaborate_Body;

    type Year        is new Calendar.Year_Number;
    type Month       is range 1 ..  12;
    type Day         is range 1 ..  31;
    type Hour        is range 0 ..  23;
    type Minute      is range 0 ..  59;
    type Second      is range 0 ..  59;
    type Millisecond is range 0 .. 999;

    type Time is
        record
            The_Year        : Year;
            The_Month       : Month;
            The_Day         : Day;
            The_Hour        : Hour;
            The_Minute      : Minute;
            The_Second      : Second;
            The_Millisecond : Millisecond;
        end record;

    type Interval is
        record
            Elapsed_Days         : Natural;
            Elapsed_Hours        : Hour;
            Elapsed_Minutes      : Minute;
            Elapsed_Seconds      : Second;
            Elapsed_Milliseconds : Millisecond;
        end record;

    type Year_Day    is range 1 .. 366;

    type Month_Name  is (January, February, March, April, May, June,
July, 
                         August, September, October, November,
December);
    type Day_Name    is (Monday, Tuesday, Wednesday, 
                         Thursday, Friday, Saturday, Sunday);

    type Period      is (Am, Pm);

    type Time_Format is (Full,            -- 01:21:06:30 PM
                         Military);       -- 13:21:06:30
    type Date_Format is (Full,            -- FEBRUARY 27, 1955
                         Month_Day_Year); -- 02/27/55

    function Is_Leap_Year  (The_Year  : in Year)          return
Boolean;
    function Days_In       (The_Year  : in Year)          return
Year_Day;
    function Days_In       (The_Month : in Month; 
                            The_Year  : in Year)          return Day;
    function Month_Of      (The_Month : in Month)         return
Month_Name;
    function Month_Of      (The_Month : in Month_Name)    return Month;
    function Day_Of        (The_Year  : in Year; 
                            The_Day   : in Year_Day)      return
Day_Name;
    function Day_Of        (The_Time  : in Time)          return
Year_Day;
    function Time_Of       (The_Year  : in Year;  
                            The_Day   : in Year_Day)      return Time;
    function Period_Of     (The_Time  : in Time)          return Period;
    function Time_Of       (The_Time  : in Time)          return
Calendar.Time;
    function Time_Of       (The_Time  : in Calendar.Time) return Time;

    function Time_Image_Of (The_Time  : in Time; 
                            Time_Form : in Time_Format := Full) 
                                                          return String;
    function Date_Image_Of (The_Time  : in Time; 
                            Date_Form : in Date_Format := Full) 
                                                          return String;
    function Value_Of      (The_Date  : in String; 
                            The_Time  : in String; 
                            Date_Form : in Date_Format := Full; 
                            Time_Form : in Time_Format := Full) 
                                                          return Time;

    function Duration_Of (The_Interval : in Interval)     return
Duration;
    function Interval_Of (The_Duration : in Duration)     return
Interval;
    function Image_Of    (The_Interval : in Interval)     return String;
    function Value_Of    (The_Interval : in String)       return
Interval;

    Lexical_Error : exception;

end Booch.Calendar_Utilities;

--        Original Booch Components (Ada 95 elaboration version)
--                               
-- Copyright (C) 2000 Grady Booch
--
-- This is free software; you can redistribute it and/or modify it under
-- terms of the GNU General Public License as published by the Free
Software
-- Foundation; either version 2, or (at your option) any later version.
-- This software is distributed in the hope that it will be useful, but 
-- WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License
-- for more details. Free Software Foundation, 59 Temple Place - Suite
-- 330, Boston, MA 02111-1307, USA.
--
-- As a special exception, if other files instantiate generics from this
-- unit, or you link this unit with other files to produce an
executable,
-- this unit does not by itself cause the resulting executable to be
-- covered by the GNU General Public License. This exception does not
-- however invalidate any other reasons why the executable file might be
-- covered by the GNU General Public License.  
--
-- The book
_SOFTWARE_COMPONENTS_WITH_Ada__Structures,_Tools,_and_Subsystems_
-- ISBN 0-8053-0609-9 by Grady Booch, fully describes the design and
usage 
-- of this software.
--
-- The Ada 83 version of the components is the exact version described
in
-- the book mentioned above.  The Ada 95 elaboration version differs
only in
-- that each component unit is a child of a root package named "Booch"
and
-- each package declaration includes the most appropriate elaboration
control
-- pragma.  In addition, the Ada 95 child iteration version eliminates
the
-- distinct iterator and noniterator forms for components that had them
and
-- instead makes the associated "Iterate" procedures available as
children of
-- those components.  More enhanced versions may be produced in the
future.
--
-- The Original Booch Components are actively maintained and enhanced
-- by Vincent Marciante and Samuel T. Harris and may be found at the 
-- AdaPower web site (http://www.adapower.com) provided by David Botton.



  parent reply	other threads:[~2001-03-14  2:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-13  0:04 calander package arcele
2001-03-13 14:24 ` Marin David Condic
2001-03-14 11:52   ` Mario Amado Alves
2001-03-13 15:52 ` Ted Dennison
2001-03-13 16:45   ` Marin David Condic
2001-03-13 18:52     ` Ted Dennison
2001-03-13 19:50       ` Marin David Condic
2001-03-13 21:47         ` Randy Brukardt
2001-03-13 22:32           ` Marin David Condic
2001-03-14  2:04           ` Vincent Marciante [this message]
2001-03-14 14:47             ` Marin David Condic
2001-03-15  0:23             ` Jeffrey Carter
2001-03-15 17:45               ` Marin David Condic
2001-03-16 16:54               ` Robert A Duff
2001-03-14  0:51         ` tmoran
2001-03-14 15:21           ` Marin David Condic
2001-03-15  1:39             ` Randy Brukardt
2001-03-15 17:55               ` Marin David Condic
2001-03-16 14:50                 ` Planned increment for package Datetime Mario Amado Alves
2001-03-14  2:19       ` calander package Jeffrey Carter
2001-03-14  8:33 ` Pascal Obry
replies disabled

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