Anniversary Calculation Program Version 1.0
Author: Andreas Zoufal (zoufal@zdfzs.arcs.ac.at)
Copyright 1996
This Version is FREEWARE

Syntax: ANV [/?] [/v] [/f<filename>] [/o<filename>]
            [/s<year>] [/e<year>] [/c<count>]

/?              prints help text
/v              prints progress information
/f<filename>    data file (default: ANV.INI)
/o<filename>    ouput file (default: console)
/s<year>        starting year (default: actual year)
/e<year>        ending year (default: actual year)
/c<count>       year count (default: 1)

The year range is valid in [1583, 65535]
Maximum of 1000 anniversary entries supported
Maximum of 100 variable entries supported



PURPOSE
=======

This program calculates 3 types of anniversary output:

- days with constant date (like Newyear, Christmas, Birthdays, etc.)
- days relative to the eastern date (catolic anniversaries)
- days relative to weekday in a month (mothersday is the second
  sunday in may)

I wrote it specially for usage with the Lotus Organizer 2.1 for
import my personal dates. It should be useful for other import formats
too.



GENERAL
=======

The basic calendar is the gregorian calendar with the starting year 1583.
Julian calendar or other starting points for the gregorian calendar are
not implemented.

Output is generated for the full year(s). If a calculated anniversary is
not valid in the desired year, the output is skiped (like Feb. 29, leap
day in 1995).

The output is 100 % user definable. The definitions are stored in a
database file in the format of an "INI" file. See the format description
below.

The program is a 32 bit console application and is tested with Windows NT
3.5 and Windows 95. I used Microsoft Visual C++ 4.0 for development.
Windows 3.1 or Windows for Workgroups 3.11 with win32s support is not
tested.

There are two reasons for writing a console application: first I'm not a 
Windows programming guru. I would'nt spend a lot of time for creating a
GUI program. And second I think it should be possible easily to use it
within an other program using an "execute" command (for example an user
interface program).

The program terminates with an exit code = 0 for success. Help text
printout and any other reason (database error, wrong command line syntax)
generates an exit code other than 0.



COMMAND LINE SYNTAX
===================

See the summary at the beginning of this file. Later options
overide previous ones.

/?              Prints help text and terminates the program.

/v              Prints progress information. I used it for debugging.
                There is a lot of information mixed with the output of
                the program (if no output file is specified).

/f<filename>    Data file. Default: ANV.INI in the current
                directory. If there is no file in the current directory,
                the program searches for a matching file in the following
                directories in the following sequence: 

                1. The directory from which the application loaded. 
                2. The Windows system directory (32 bit and than 16 bit
                   for Windows NT). 
                3. The Windows directory.
                4. The directories that are listed in the PATH environment
                   variable. 
  
                The Program terminates with an error if no anniversary
                entries are found in the database file.

/o<filename>    Ouput file. Default: output to console. You can redirect
                and pipe the console output. If the program cannot create
                the desired output file an error is generated. It
                overwrites existing files without comments. You can
                redirect the output to the NUL device by using "/oNUL".

/s<year>        Starting year. Default: the actual year of the local
                system time. By changing the starting year the ending year
                will be moved with.

/e<year>        Ending year. Default: the actual year of the local system
                time. The starting year remains unchanged.

/c<count>       Year count. Default: 1. The starting year remains
                unchanged and the ending year is moved.



DATABASE DEFINITION
===================

The program reads the database using the "GetPrivateProfileString"
function. Therefore the basic definition style is the same like an "INI"
file. Section names and entry names generally are not case sensitive.

The values of the definitions are case sensitive. The usage of the
variable names is case sensitive too!

Headers, footers and anniversary entries may use variables. There are some
system variables defined:

- "%ct%": total hit count over all years.
- "%cy%": hit count for the actual year.
- "%ys%": actual year without the century with leading 0.
- "%yl%": actual year including the century.
- "%ms%": actual month as number without leading 0.
- "%mm%": actual month as number with leading 0.
- "%ml%": actual month as text (see section [Months and Weekdays]).
- "%ds%": actual day as number without leading 0.
- "%dl%": actual day as number with leading 0.
- "%w%":  actual weekday as text (see section [Months and Weekdays]).
- "%t%":  actual title of the anniversary (see section [Anniversaries]).

- "\\":   inserts a '\' in the output.
- "\n":   inserts a CR/LF in the output.
- "\t":   inserts a TAB in the output.
- "\f":   inserts a FF in the output.

1.) Section [Months and Weekdays]
---------------------------------

This section and/or its entries are optional. The following entries are
used:

- "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
  "Oct", "Nov", "Dec". The values are used with the "%ml%" variable
  for output. Default values are the entry names itself.
- "Sun", "Mon", "Tue", "Wen", "Thu", "Fri", "Sat". The values are used
  with the "%w%" variable for output. Default values are the
  entry names itself.
  
2.) Section [Headers and Footers]
---------------------------------

This section and/or its entries are optional. The following entries are
used:

- "H1": main header. It is the first output of the program.
- "F1": main footer. It is the last output of the program.
- "H2": year header. It is the first output for ever year.
- "F2": year footer. It is the last output for ever year.

3.) Section [Variables]
---------------------------------

This section and/or its entries are optional. The defined variables can
be used with a leading and trailing "%" in previous defined variables,
headers, footers, and anniversary entries. Be careful: you can override
system variables!

Duplicate variable names are not allowed.

Example: "date = %w%, %ds% %ml% %yl%"

4.) Section [Anniversaries]
---------------------------

This section must contain entries. They are the definitons of the
anniversaries. The name of the entry is the title of the anniversary and
is iserted in the output case sensitive.

Following types of entries are used:

- "<title> = F:<day>:<month>;<text>" where <day> is a number between 1 and
  31, month is the short month name ("Jan", "Feb", etc.) and text is the
  output string including variables. The entry type "F" defines fixed day
  anniversaries.

- "<title> = E:<offset>;<text>" where <offset> is a positive or negative
  number defining  the offset to eastern sunday. Text is the output string
  including variables. The entry type "E" defines eastern relative
  anniversaries.

- "<title> = V:<number>:<weekday>:<month>;<text> where number is between
  1 and 4 or 'L'. It defines the occurance of the weekday in the month
  ('L' means the last one). <weekday> is the short weekday name ("Sun",
  "Mon" etc.), month is the short month name ("Jan", "Feb", etc.) and text
  is the output string including variables. The entry type "V" defines
  weekday relative anniversaries.



VERSION HISTORY
===============

Version 1.0 : initial version



SUMMARY
=======

If you have any comments, error reports or if you find this program
useful, please send me an e-mail.

Andreas Zoufal (zoufal@zdfzs.arcs.ac.at)
