home *** CD-ROM | disk | FTP | other *** search
- # ---------------------------------------------------------------------------
- #
- # DEFS.REM
- #
- # This file is a reminder script, which contains a few handy definitions.
- # Cut and paste as desired!
- #
- # This file is part of REMIND.
- # Copyright (C) 1992 by David F. Skoll
- #
- # ---------------------------------------------------------------------------
-
- # It's handy to have symbolic constants for weekdays and month names
- SET Sunday 0
- SET Monday 1
- SET Tuesday 2
- SET Wednesday 3
- SET Thursday 4
- SET Friday 5
- SET Saturday 6
-
- # ---------------------------------------------------------------------------
-
- SET Jan 1
- SET Feb 2
- SET Mar 3
- SET Apr 4
- SET May 5
- SET Jun 6
- SET Jul 7
- SET Aug 8
- SET Sep 9
- SET Oct 10
- SET Nov 11
- SET Dec 12
-
- # ---------------------------------------------------------------------------
-
- SET January 1
- SET February 2
- SET March 3
- SET April 4
- SET May 5
- SET June 6
- SET July 7
- SET August 8
- SET September 9
- SET October 10
- SET November 11
- SET December 12
-
- # ---------------------------------------------------------------------------
-
- # A function which, given a time, returns a string in "AM/PM" format.
- # Unfortunately, has a leading zero. Example call:
- # set a ampm(now())
-
- FSET ampm(x) iif(x<1:00, x+12*60+"am", \
- iif(x<12:00, x+"am", \
- iif(x<13:00, x+"pm", x-12*60+"pm")))
-
- # A function which knocks off a single leading zero from a string
-
- FSET no_lz(s) iif(substr(s, 1, 1)=="0", substr(s, 2), s)
-
- # ---------------------------------------------------------------------------
-
- # Here's a tricky problem: The 4th of July is a holiday in the U.S.
- # However, if it falls on a Saturday, the previous Friday is a holiday.
- # If it falls on a Sunday, the next Monday is a holiday. Here's how
- # to do it. NOTE that the following procedure makes the OMIT context
- # dependent upon the current date. SInce it only depends on the current
- # year, which is not likely to change while producing a calendar, we
- # are fairly safe. However, reminders with huge DELTA or BACK components
- # may not operate as expected. In general, any time you make OMIT
- # dependent upon the current date, it's tricky and results may not be
- # what you expect. You should try to make sure that the OMIT context
- # "near" any current reminders will not change during a calendar run.
-
- set thisyear year(today())
-
- OMIT 4 July MSG The real thing!
-
- # Check for Saturday case
- if wkdaynum(date(thisyear, 7, 4)) == Saturday
- OMIT 3 July [thisyear] MSG 4 July (observed)
- endif
-
- # Check for Sunday case
- if wkdaynum(date(thisyear, 7, 4)) == Sunday
- OMIT 5 July [thisyear] MSG 4 July (observed)
- endif
-
- # ---------------------------------------------------------------------------
-
- # Here's the since() function - quite useful for remembering how
- # old kids are:
-
- fset since(x) ord(year(trigdate())-x)
-
- # Here's an example of how to use it:
- REM 1 Nov ++12 MSG %"Dean's [since(1984)] birthday%" is %b.
-
- # ---------------------------------------------------------------------------
-
- # How do we get a double-quote into a string???? Only works on ASCII
- # machines
-
- set example "The last word of this sentence is in " \
- + char(34) + "quotes." + char(34)
-