Branch: Tag:

2001-05-05

2001-05-05 15:18:49 by Mirar (Pontus Hagland) <pike@sort.mirar.org>

removing "AutoDOC mk II" conversion
YMD.pmod: adding : to day/time separator in dwim

Rev: lib/modules/Calendar.pmod/Calendar.pike:1.5
Rev: lib/modules/Calendar.pmod/Coptic.pmod:1.5
Rev: lib/modules/Calendar.pmod/Discordian.pmod:1.6
Rev: lib/modules/Calendar.pmod/Event.pmod:1.13
Rev: lib/modules/Calendar.pmod/Gregorian.pmod:1.6
Rev: lib/modules/Calendar.pmod/ISO.pmod:1.6
Rev: lib/modules/Calendar.pmod/Islamic.pmod:1.6
Rev: lib/modules/Calendar.pmod/Julian.pmod:1.7
Rev: lib/modules/Calendar.pmod/Language.pmod:1.16
Rev: lib/modules/Calendar.pmod/Roman.pmod:1.5
Rev: lib/modules/Calendar.pmod/Ruleset.pike:1.9
Rev: lib/modules/Calendar.pmod/Stardate.pmod:1.7
Rev: lib/modules/Calendar.pmod/Swedish.pmod:1.6
Rev: lib/modules/Calendar.pmod/TZnames.pmod:1.9
Rev: lib/modules/Calendar.pmod/Time.pmod:1.13
Rev: lib/modules/Calendar.pmod/TimeRanges.pmod:1.17
Rev: lib/modules/Calendar.pmod/Timezone.pmod:1.18
Rev: lib/modules/Calendar.pmod/YMD.pmod:1.31

17:   // base classes   // ----------------------------------------------------------------    + //! module Calendar + //! submodule Event + //! subclass Event + //! <ref>Event</ref> is a base class, defining what + //! methods an Event need to have.    -  + //! method array(TimeRange) scan(TimeRange in) + //! This calculates the eventual events that + //! is contained or overlapped by the given timerange. + //! + //! Example: + //! <tt>Event.christmas_eve->scan(Year(2000))</tt> + //! => <tt>({ Day(Sun 24 Dec 2000) })</tt> + //! + //! <ref>scan</ref> uses <ref>next</ref> if not overloaded. + //! + //! note: + //! <ref>scan</ref> can return an array of overlapping timeranges. + //! + //! This method must use <tt>in->calendar_object-></tt><i>type</i> + //! to create the returned timeranges, and must keep the ruleset.    - //! @[Event] is a base class, defining the - //! methods an Event need to have. + //! method TimeRange next(TimeRange from,void|int(0..1) including) + //! method TimeRange previous(TimeRange from,void|int(0..1) including) + //! This calculates the next or previous occurance of the event, + //! from the given timerange's <b>start</b>, + //! including any event occuring at the start if that flag is set. + //! + //! It returns zero if there is no next event. + //! + //! This method is virtual in the base class. +    class Event   {    string name;
28:       constant is_event=1;    -  //! These functions calculate the next or previous occurance of the event, -  //! from the given timerange's @b{start@}, -  //! including any event occuring at the start if the -  //! @[including] flag is set. -  //! -  //! @returns -  //! Zero is returned if there is no next event. -  //! -  //! @note -  //! These methods are virtual in the base class. +     TimeRange next(void|TimeRange from,void|int(0..1) including);    TimeRange previous(void|TimeRange from,void|int(0..1) including);      // what events in this period? -  //! This calculates the eventual events that -  //! are contained or overlapped by the given timerange. -  //! -  //! @example -  //! @code{Event.christmas_eve->scan(Year(2000))@} -  //! => @code{({ Day(Sun 24 Dec 2000) })@}. -  //! -  //! @[scan()] uses @[next()] if not overloaded. -  //! -  //! @note -  //! @[scan()] can return an array of overlapping timeranges. -  //! -  //! This method must use @tt{in->calendar_object->@i{type@}@} -  //! to create the returned timeranges, and must keep the ruleset. +     array(TimeRange) scan(TimeRange in)    {    array res=({});
186:   }       - //! This is created by the @[Namedays] classes + //! module Calendar + //! submodule Event + //! subclass Nameday + //! This is created by the <ref>Namedays</ref> classes   //! to represent an event for a name. -  +    class Nameday   {    inherit Day_Event;
214:    }   }    + //! module Calendar + //! submodule Event + //! subclass Namedays   //! This contains a ruleset about namedays.   //! inherits Event -  +    class Namedays   {    inherit Event;
242:    lookup=_lookup;    }    + //! method array(string) names(TimeRange t)   //! Gives back an array of names that occur during   //! the time period, in no particular order. -  +     array(string) names(TimeRange t)    {   // optimize this?    return predef::`|(({}),@values(namedays(t)));    }    -  + //! method mapping(TimeRange:array(string)) namedays(TimeRange t)   //! Gives back an table of days with names that occur during   //! the time period. Note that days without names will not   //! appear in the returned mapping. -  +     mapping(TimeRange:array(string)) namedays(TimeRange t)    {    int jd=t->julian_day();
309:    return indices(namedays(in));    }    -  //! @decl TimeRange previous(TimeRange from,void|int(0..1) including) -  //! @decl TimeRange next(TimeRange from,void|int(0..1) including) + //! method TimeRange previous(TimeRange from,void|int(0..1) including) + //! method TimeRange next(TimeRange from,void|int(0..1) including)       static TimeRange _find(TimeRange t,int including,int direction)    {
626:    }   }    + //! module Calendar + //! submodule Event + //! subclass Date   //! This class represents the event of a given gregorian date.   //! For instance,   //! <tt>Event.Date(12,10)->next(Day())</tt>   //! finds the next 12 of October.   //! -  + //! method void create(int month_day,int month) + //! The event is created by a given month day and + //! a month number (1=January, 12=December). +    class Date   {    inherit Day_Event;
639:       int yd;    -  //! @decl void create(int month_day, int month) -  //! The event is created by a given month day and -  //! a month number (1=January, 12=December). +     void create(int _md,int _mn)    {    md=_md;
676:    }   }    + //! module Calendar + //! submodule Event + //! subclass Date_Weekday   //! This class represents the event that a given gregorian date appears   //! a given weekday.   //! For instance,   //! <tt>Event.Date_Weekday(12,10,5)->next(Day())</tt>   //! finds the next 12 of October that is a friday.   //! -  + //! method void create(int month_day,int month,int weekday) + //! The event is created by a given month day, + //! a month number (1=January, 12=December), and a + //! weekday number (1=Monday, 7=Sunday). + //! + //! note: + //! The week day numbers used + //! are the same as the day of week in the <ref>ISO</ref> calendar - + //! the <ref>Gregorian</ref> calendar has 1=Sunday, 7=Saturday. +    class Date_Weekday   {    inherit Day_Event;
691:    int yd;    int jd_wd;    -  //! @decl void create(int month_day,int month,int weekday) -  //! The event is created by a given month day, -  //! a month number (1=January, 12=December), and a -  //! weekday number (1=Monday, 7=Sunday). -  //! -  //! @note -  //! The week day numbers used -  //! are the same as the day of week in the @[ISO] calendar - -  //! the @[Gregorian] calendar has 1=Sunday, 7=Saturday. +     void create(int _md,int _mn,int wd)    {    md=_md;
737:    }   }    + //! module Calendar + //! submodule Event + //! subclass Monthday_Weekday   //! This class represents the event that a given gregorian   //! day of month appears a given weekday.   //! For instance, - //! @code{Event.Monthday_Weekday(13,5)->next(Day())@} + //! <tt>Event.Monthday_Weekday(13,5)->next(Day())</tt>   //! finds the next friday the 13th.   //! -  + //! method void create(int month_day,int weekday) + //! The event is created by a given month day, + //! and a weekday number (1=Monday, 7=Sunday). + //! + //! note: + //! The week day numbers used + //! are the same as the day of week in the <ref>ISO</ref> calendar - + //! the <ref>Gregorian</ref> calendar has 1=Sunday, 7=Saturday. +    class Monthday_Weekday   {    inherit Day_Event;
750:    int md;    int jd_wd;    -  //! @decl void create(int month_day, int weekday) -  //! The event is created by a given month day, -  //! and a weekday number (1=Monday, 7=Sunday). -  //! -  //! @note -  //! The week day numbers used -  //! are the same as the day of week in the @[ISO] calendar - -  //! the @[Gregorian] calendar has 1=Sunday, 7=Saturday. +     void create(int _md,int wd)    {    md=_md;
799:    }   }    + //! module Calendar + //! submodule Event + //! subclass Weekday   //! This class represents any given weekday.   //! For instance,   //! <tt>Event.Weekday(5)->next(Day())</tt>
808:   //! "monday", "tuesday", "wednesday", "thursday",   //! "friday", "saturday" and "sunday".   //! + //! method void create(int weekday) + //! The event is created by a given + //! weekday number (1=Monday, 7=Sunday). + //! + //! note: + //! The week day numbers used + //! are the same as the day of week in the <ref>ISO</ref> calendar - + //! not the <ref>Gregorian</ref> or <ref>Julian</ref> + //! calendar that has 1=Sunday, 7=Saturday. +    class Weekday   {    inherit Day_Event;
815:       int jd_wd;    -  //! @decl void create(int weekday) -  //! The event is created by a given -  //! weekday number (1=Monday, 7=Sunday). -  //! -  //! @note -  //! The week day numbers used -  //! are the same as the day of week in the @[ISO] calendar - -  //! not the @[Gregorian] or @[Julian] -  //! calendar that have 1=Sunday, 7=Saturday. +     void create(int wd,void|string _id)    {    jd_wd=(wd+6)%7; // convert to julian day numbering
1053:    }   }    + //! module Calendar + //! submodule Event + //! subclass SuperEvent   //! This class holds any number of events,   //! and adds the functionality of event flags.   //! - //! @note + //! note:   //! Scanning (scan_events,next,etc) will drop flag information. - //! Dig out what you need with @tt{->@[holidays]@} et al first. + //! Dig out what you need with -><ref>holidays</ref> et al first. +    class SuperEvent   {    inherit Event;
1104:    else other_events+=({e});    }    -  //! @decl SuperEvent filter_flag(string flag) -  //! @decl SuperEvent holidays() -  //! @decl SuperEvent flagdays() + //! method SuperEvent filter_flag(string flag) + //! method SuperEvent holidays() + //! method SuperEvent flagdays()    //! Filter out the events that has a certain flag set.    //! Holidays (flag "h") are the days that are marked    //! red in the calendar (non-working days),