From: colbach@nessie.cs.id.ethz.ch (Philippe Colbach)
Newsgroups: comp.sys.hp48
Subject: *MY* Calendar version
Date: 7 Feb 92 15:13:03 GMT
Organization: Swiss Federal Institute of Technology (ETH), Zurich, CH
Nntp-Posting-Host: nessie


Well, I am publishing another calendar library ... probably the 100th one :-)

TITEL: CALDR
ROMID: 963
BYTES: 7647

COMMAND     INPUT         OUTPUT
[DIARY]     (1: Date )*
* If Flag -4 set!

  [DIARY] draws a calendar and enables a cursor (reversed) to move over the
different days of one month. The program automatically changes to the next or
previous month if you leave the screen with the cursor.
  The calendar is looking like this (f.e. April 1992):

  MO TU WE TH FR SA SU
         1  2  3  4  5 
   6  7  8  9 10 11 12
  13 14 15 16 17 18 19
  20 21 22 23 24 25 26
  27 28 29 30
        April 1992
 [menu to move cursor]

  When the program is started, it takes the current month to draw the first
calendar and moves the cursor to the current day. If flag -4 is set, [DIARY]
needs a date as input. Then you can move the cursor by pressing the menu
labels [DECA+], [DECA-], [YEAR+], [YEAR-], [MTH+] and [MTH-] or the cursor
keys [up], [down], [left] and [right]. When you have moved the cursor to your
chosen date, press [ENTER] ...
  The program then
1) puts the   3: DAY
        the   2: MONTH
    and the   1: YEAR   defined by the current cursor position on the stack
2) and calls a subroutine called [DAY].
  I wrote a primitiv [DAY] subroutine as example!
  This subroutine can now process these data ...; either the subroutine 
aborts the program or it returns to the main program. In the last case, 1
stack argument is needed:
1) *1* which means that the program redraws the current calendar and 
reactivates the cursor ...
2) *0* to exit the program!
  Take care that the subroutine [DAY] leaves unchanged the GRAPH!! Otherwise
the current calendar can't be redrawn!!
To leave the program, just press [ATTN] ...

COMMAND     INPUT        OUTPUT
[EDCAL]     (2: Month)*  (n: various outputs)
            (1: Year )*
*If Flag -4 set

  [EDCAL] also draws the calendar of the current month (or, in case that flag
-4 is set, defined by two stack arguments  2: MONTH
					   1: YEAR). You can change to another
month by pressing the menu labels [DECA+], [DECA-], [YEAR+], [YEAR-], [MTH+]
and [MTH-]. When the chosen month is displayed, press [NXT] and the following
menu appears:
[CURS] [GROB] [STOB] [YEAR] [ALRM] [MOON]

[CURS] calls [DIARY] activating the reversed cursor.
[GROB] puts the graphic of the current display on the stack (with moon phases).
[STOB] puts the current calendar string on the stack (without moon phases).
[YEAR] prints (IR or WIRE) the calendar of the current year (with moon phases).
Very long because of complicate moon phase computations!
[ALRM] marking all the days by the number of alarms set.
[MOON] draws the moon phases. It uses a very accurate formula published in
comp.sys.hp48 a long time ago. [MOON] calculates the phases for GMT. If you
want to change the time zone, you have to store the time difference between
your zone and Greenwich into XLIB 963 7 (default value is 0 DAYS). To do so,
you unfortunately must change the library into a directory ([RCLIB], Hackit
Library) ... Attention: the unit is DAYS and not HOURS! Negative value for
the USA ...
Press [ATTN] to abort the program ...

COMMAND     INPUT        OUTPUT
[CALN]      2: Month
            1: Year      1: "String"

[CALN] creats a calendar string
For instance:
<< -> Y << 1 12 FOR c c Y CALN PR1 DROP NEXT >> >>

COMMAND     INPUT        OUTPUT
 				   3: b (Real), No of first alarm
				   2: e (Real), No of last alarm
[ALRM]      1: Date      1: 0  or  1: n (Real)

[ALRM] tests if alarms are set for that date. If not, 0 is put on the stack!
If yes, it puts the No (used by the alarm command RCLALARM) of the first and
the last alarm of that date on level 3 and 2 and the number of alarms on 
level 1.
For Instance:
<< ALRM IF THEN FOR c c RCLALARM NEXT >>

COMMAND     INPUT        OUTPUT
[EASTER]    1: Year      1: Date

[EASTER] calculates the date of easter.

COMMAND     INPUT        OUTPUT
			 2: % (Integer) at 00.00h
[MOON]      1: Date      1: % (Integer) at 24.00h

[MOON] calculates the % of the illuminated moon phase for that day.

EXAMPLE OF [DAY] SUBROUTINE:
----------------------------
%%HP: T(3)A(D)F(.);
\<<
"        EXAMPLE       "
3 \->GROB NEG \->LCD
10000 / + 100 / + 0
TSTR 1 12 SUB
"  Date: " SWAP + 3
DISP TEXT { "CURS"
"" "" "" "" "EXIT"
} TMENU -1 WAIT 0
MENU 16.1 SAME
\>>


Ok, that's it ...

					Philippe Colbach
					colbach@nessie.cs.id.ethz.ch

