Zum Inhalt springen

René’s Avigo Page: German Hollidays (Feiertage)

German Hollidays

This application might only be useful in Germany. But I will stay in English here
nevertheless, since the purpose of this page is to describe the programming aspects of the application. The use
is self explaining anyway. You find the application with source in

The program does not insert the computed days into the calendar, because I do
not know how to do this. If anybody can do that for me, please help out!

Here is a screen dump of the application.

As you can see, I stick with my main layout of a DeskBox with a menu. In this
deskbox, you will find two objects of type NUMBERSET attached at each other, a button and the output area. The
code to insert the number tickers and the button is simply

	/* A number ticker for the year */	_DATE date;
PNUMBERSET *Year,*Century;
int d=date.year+1901;
Century=(PNUMBERSET *)CreateNumberSet(
Year=(PNUMBERSET *)CreateNumberSet(

/* A button to recompute the year */ PBUTTON *Compute; Compute=(PBUTTON *)CreateButton( id++,Year->right+10,30,Year->right+80, MK_FAR_PTR("Berechnen"),cmdCompute,bttBasic); LoadBank(&(dsk->insert)); dsk->insert((VOID_PTR)dsk,Compute); topline=Century->bottom+15;

The year is initialized with the current year. The range of the first ticker is
19,20 and the range of the second 0,…,99. This gives a range from 1900 to 2099. The Easter algorithm works for
other days too, but the Avigo has only this date range and I wanted to use its date computations and output functions
for simplicity. By the way, the Easter algorithm is from a paper of St. Deschauer. Thanks to him!

The output is drawn to the screen in a function draw_output. This is called from
the DESKBOX drawing routine and from the event handler, when the Berechne button is pressed.

The easter algorithm is this.

typedef struct _Datum
{ int day;
int month;
int year;
} Datum;

Datum Eastern;

void computeEasternGregorian ()
{ int s,m,u,M,N,a,b,c,d,e;
M=(15+u)%30; N=(6+s)%7;
a=Eastern.year%19; b=Eastern.year%4; c=Eastern.year%7;
if (d==29)
{ d=28; e=(e+1)%7;
if (a>=11 && d==28)
{ d=27; e=(e+1)%7;
if (Eastern.day>31)
{ Eastern.month=4;
else Eastern.month=3;

Beware not to take the _DATE structure of the Avigo. This has only fields of type
char. Then you have to convert these days to int before using them in int computations. Moreover, the year counts
from 1901 (making 1900 an invalid year). The above algorithm is correct from 1583 on. It is only valid for the
Western Eastern date. There is another algorithm for the Orthodox church.

There is not much more to this program. So you should be able to understand the
program now.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert