< previous page page_176 next page >

Page 176
/* netherl1.h
Header file containing the prototypes for holiday functions
for the Netherlands.
*/
#ifndef __NETHERL1_H
#define __NETHERL1_H
    extern struct DATE_INFO new_year (int year);
    extern struct DATE_INFO good_friday (int year);
    extern struct DATE_INFO easter_monday (int year);
    extern struct DATE_INFO queens_birthday (int year);
    extern struct DATE_INFO liberation_day (int year);
    extern struct DATE_INFO ascension_day (int year);
    extern struct DATE_INFO whit_monday (int year);
    extern struct DATE_INFO prinsjesdag (int year);
    extern struct DATE_INFO christmas (int year);
    extern struct DATE_INFO boxing_day (int year);
#endif
Then, the coding of holiday_netherlands () is straight-forward. This routine demonstrates the simplicity and modularity of the approach outlined in SCDTL. Each function defining a day of observance is written to return a date, and each is written using the handful of utility routines. Each routine is maintained separately. The holiday routine itself simply calls the various day routines in order. Modifying this routine to add, change, or delete day functions is very easy, since each routine is entirely independent.
The remaining step is the code for the individual day of observance functions. These functions are also simple and use the utility functions as described above.
Adding a holiday to this application would be very simple. Assume, as an example, that Prinsjesdag were not present in the original set. Adding it would entail the following steps:
Code the prinsjesdag () routine.
Add the prinsjesdag () prototype to the header file, netherl1.h.
Add the call of prinsjesdag () to holiday_netherlands (). Preservation of chronological order would have this call inserted between the calls to whit_monday () and christmas ().
This last point raises another. The set of functions chosen for the Netherlands do not happen to involve any dates that can overlap, so the order of the calls in holiday_netherlands () correctly determines the order of the appearance of the dates in the report. If overlap were possible, then it could be easily solved in this case by breaking the solution into three parts:
1.) A front-end program, which generates dates in much the same way the DTLT_142 program does but writes to a file. For each date, it outputs the Julian Day number as a type long variable, the date, and the name of the day of observance.

 
< previous page page_176 next page >