"Fossies" - the Fresh Open Source Software Archive 
Member "remind-04.02.07/examples/defs.rem" (9 Oct 2023, 17814 Bytes) of package /linux/misc/remind-04.02.07.tar.gz:
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the last
Fossies "Diffs" side-by-side code changes report for "defs.rem":
04.02.03_vs_04.02.04.
1 #############################################################################
2 # #
3 # DEFS.REM #
4 # #
5 # This file is a reminder script, which contains a few handy definitions. #
6 # Cut and paste as desired! Also, near the end, there are a bunch of #
7 # holiday definitions for the U.S. #
8 # #
9 # Some examples provided by George M. Sipe <gsipe@pyratl.ga.pyramid.com> #
10 # #
11 # U.S. holidays provided by Dave Rickel <drickel@sjc.mentorg.com> #
12 # #
13 # Use your text editor to search for: #
14 # "#USHOLS" for U.S. holidays #
15 # "#JHOLS" for Jewish holidays #
16 # "#PSSTUFF" for nifty PostScript examples #
17 # #
18 # This file is part of REMIND. #
19 # Copyright (C) 1992-2023 Dianne Skoll #
20 # SPDX-License-Identifier: GPL-2.0-only
21 # #
22 #############################################################################
23
24 RUN OFF
25
26 ################################################
27 # Ensure required version of remind is used... #
28 ################################################
29 IF version() < "03.04.02"
30 ERRMSG This file requires at least version 03.01.10 of Remind.%
31 ERRMSG This version is version [version()].
32 EXIT
33 ENDIF
34
35 ###########################################################
36 # Symbolic constants and functions for "pasting"... #
37 ###########################################################
38 SET Quote CHAR(34)
39
40 # Handy constants/function for specifying week of month...
41 SET Week_1 1
42 SET Week_2 8
43 SET Week_3 15
44 SET Week_4 22
45
46 #################################################################
47 # Function that removes a single leading zero from a string... #
48 #################################################################
49 FSET _no_lz(s) IIF(SUBSTR(s, 1, 1)=="0", SUBSTR(s, 2), s)
50
51 #################################################################
52 # Return the length of the daylight/night portion of a date, #
53 # in minutes. #
54 #################################################################
55 FSET _light_len(date) MAX(SUNSET(date)-SUNRISE(date), 0)
56 FSET _dark_len(date) 1440-_light_len(date)
57
58 ############################################################
59 # Function to calculate number of years since a given year #
60 # or number of months since a given month and year... #
61 ############################################################
62 FSET _yr_num(yr) ORD($Ty - yr)
63 FSET _mo_num(mo, yr) ORD(12 * ($Ty - yr) + $Tm - mo)
64
65 # Here's an example of how to use them:
66 REM 1 Nov ++12 MSG %"John's [_yr_num(1984)] birthday%" is %b.
67 REM 1 MSG John's [_mo_num(11, 1984)] 'monthly' anniversary
68
69 #############################################################################
70 # Here's a tricky problem: The 4th of July is a holiday in the U.S.
71 # However, if it falls on a Saturday, the previous Friday is a holiday.
72 # If it falls on a Sunday, the next Monday is a holiday. Here's how
73 # to do it.
74 #
75 # For those reminders that update the OMIT context with ADDOMIT, we use
76 # SCANFROM -7 for safety; see the man page about moveable OMITs.
77 ############################################################################
78
79 # If it falls on a Saturday, bump to previous Friday
80 REM 3 JULY SCANFROM -7 ADDOMIT SATISFY [$Tw == 5] MSG Independence day (observed)
81
82 # If it falls on a Sunday, bump to following Monday
83 REM 5 July SCANFROM -7 ADDOMIT SATISFY [$Tw == 1] MSG Independence day (observed)
84
85 # If it falls on Sat or Sun, note the actual day
86 REM 4 July SCANFROM -7 ADDOMIT SATISFY [$Tw == 0 || $Tw == 6] MSG Independence day (actual)
87
88 # Otherwise observed and actual is on the 4th
89 REM 4 July SCANFROM -7 ADDOMIT SATISFY [$Tw >= 1 && $Tw <= 5] MSG Independence Day
90
91 ##########################################################################
92 # #
93 # On our UNIX system, I run a program that queries the university #
94 # library and creates a file called ".booksdue". This file is #
95 # a REMIND script to tell me when my library books are due. Here's #
96 # an example from my reminder file - it shows the use of filedate(). #
97 # When the .booksdue file is at least 7 days old, I create a new version #
98 # by querying the library computer. Note the use of realtoday() rather #
99 # than today(). #
100 # #
101 ##########################################################################
102 IF !$RunOff && !$CalMode && !$SimpleCal
103 IF REALTODAY()-FILEDATE("/home/dfs/.booksdue") >= 7
104 REM RUN /home/dfs/bilge/library/getbooks
105 ENDIF
106 ENDIF
107
108 #PSSTUFF1
109 ##########################################################################
110 # #
111 # This portion of the file contains some cute examples of the new #
112 # PS-type reminders. You need a PostScript printer or viewer to #
113 # appreciate these. To use them, pipe the output of remind -p into the #
114 # rem2ps program. More examples are in the PSSTUFF2 section, below. #
115 # #
116 ##########################################################################
117
118 # The following reminder will shade the Saturday and Sunday calendar
119 # entries.
120 REM Sat Sun SPECIAL SHADE 220
121
122 #USHOLS
123 #############################################################################
124 # #
125 # The following holidays were provided by Dave Rickel #
126 # Modified by D. Skoll to give safe OMITs for moveable holidays #
127 # #
128 # NOTE: See include/holidays/us.rem for more up-to-date definitions #
129 # #
130 #############################################################################
131
132 SET SaveTrig $NumTrig
133 SET easter EASTERDATE($Uy)
134 REM [easter-46] MSG %"Ash Wednesday%"
135 REM [easter-7] MSG %"Palm Sunday%"
136 OMIT [easter-2] MSG %"Good Friday%"
137 OMIT [easter] MSG %"Easter%" Sunday
138 REM [easter+39] MSG %"Ascension Day%"
139 REM [easter+49] MSG %"Pentecost%"
140
141 # Some holidays are omitted, some are not. You may want to change
142 # which ones are omitted - use the general forms shown below. You'll
143 # need the Week_n variables defined way up in the file.
144
145 OMIT Jan 1 MSG %"New Year's Day%"
146 REM Third Monday in Jan MSG Martin Luther King - %"MLK Day%"
147 REM Feb 2 MSG %"Ground Hog Day%"
148 REM Feb 14 MSG %"Valentine's Day%"
149 REM Third Monday in Feb SCANFROM -7 ADDOMIT MSG %"President's Day%"
150 REM Mar 17 MSG %"St. Patrick's Day%"
151
152 # The DST rules are accurate for most locations in
153 # North America
154 REM Sun Apr 1 ++2 UNTIL 1 Jan 2007 MSG Daylight Saving Time - %"DST starts%" %b
155 REM Sun Mar 8 ++2 FROM 1 Jan 2007 MSG Daylight Saving Time - %"DST starts%" %b
156
157 REM Last Sunday in October ++2 UNTIL 1 Jan 2007 MSG Daylight Saving Time - %"DST ends%" %b
158 REM First Sunday in November ++2 FROM 1 Jan 2007 MSG Daylight Saving Time - %"DST ends%" %b
159
160 REM Apr 1 MSG %"April Fool's%" Day
161
162 # US Tax Day
163 PUSH-OMIT-CONTEXT
164 # Normal case: 16 April falls Mon-Fri
165 REM 16 Apr SCANFROM -7 ADDOMIT SATISFY [$Tw >= 1 && $Tw <= 5] MSG Emancipation Day
166
167 # 16 April falls on Saturday: Observe on the 15th
168 REM 15 Apr SCANFROM -7 ADDOMIT SATISFY [$Tw == 5] MSG Emancipation Day (observed)
169
170 # 16 April falls on Sunday: Observe on the 17th
171 REM 17 Apr SCANFROM -7 ADDOMIT SATISFY [$Tw == 1] MSG Emancipation Day (observed)
172
173 # If you live in Maine or Massachussetts, uncomment the next line
174 # REM Third Monday in April SCANFROM -7 ADDOMIT MSG Patriots Day
175
176 REM Apr 15 OMIT Sat Sun AFTER MSG Tax Day
177 POP-OMIT-CONTEXT
178
179 REM May 5 MSG %"Cinco de Mayo%"
180 REM First Sat in May MSG %"Kentucky Derby%"
181 REM Second Sun in May MSG %"Mother's Day%"
182 REM Third Sat in May MSG %"Armed Forces Day%"
183 REM Last Monday in May SCANFROM -7 ADDOMIT MSG %"Memorial Day%"
184 REM Jun 14 MSG %"Flag Day%"
185 REM Third Sun in June MSG %"Father's Day%"
186 REM First Mon in Sep SCANFROM -7 ADDOMIT MSG %"Labor Day%"
187 REM Second Mon in Oct MSG %"Columbus Day%"
188 REM Nov 11 MSG %"Veterans Day%"
189
190 REM Oct 30 MSG %"Mischief Night%"
191 REM Oct 31 MSG %"Halloween%"
192 REM Tue Nov 2 SCANFROM -7 SATISFY [($Ty % 4) == 0] MSG %"Election Day%"
193 REM Thu Nov [Week_4] SCANFROM -7 ADDOMIT MSG %"Thanksgiving Day%"
194 REM Fri Nov [Week_4+1] SCANFROM -7 ADDOMIT MSG %"Thanksgiving (cont.)%"
195 OMIT Dec 24 MSG %"Christmas Eve%"
196 OMIT Dec 25 MSG %"Christmas%" Day
197
198 ##########################################################################
199 # #
200 # If any US holidays were triggered above, shade in the calendar #
201 # entry in PostScript. #
202 # #
203 ##########################################################################
204 if $NumTrig > SaveTrig
205 REM SPECIAL SHADE 220
206 endif
207
208 ############################################################################
209 # A meeting on the first Monday of every month which is moved to the #
210 # second Monday in the event of a holiday. #
211 ############################################################################
212
213 # First, the normal meeting. However, the SKIP keyword means this
214 # one won't be triggered if the first Monday is a holiday
215 REM First Monday SKIP MSG Meeting
216
217 # Now, calculate the "potential" delayed meeting
218 REM Second Monday SATISFY 1
219
220 # But only actually trigger the delayed meeting if the previous
221 # Monday was a holiday
222 IF ISOMITTED($T-7)
223 REM [$T] MSG Delayed meeting
224 ENDIF
225
226 #PSSTUFF2
227 ##########################################################################
228 # #
229 # Since the SHADE special blots out any previous PostScript #
230 # reminders for a date, these examples need to follow the US Holidays #
231 # section, which uses SHADE. #
232 # #
233 ##########################################################################
234
235 # The following will fill in the Hebrew dates on the calendar. For this
236 # example, I recommend that you use the -sd 10 option for Rem2PS.
237 REM PS Border Border moveto \
238 /DayFont findfont DaySize scalefont setfont \
239 ([hebday($U)] [hebmon($U)]) show
240
241 # Fill in the phases of the moon on the PostScript calendar
242 REM [moondate(0)] SPECIAL MOON 0
243 REM [moondate(1)] SPECIAL MOON 1
244 REM [moondate(2)] SPECIAL MOON 2
245 REM [moondate(3)] SPECIAL MOON 3
246
247 # The following example puts sunrise and sunset times in PostScript in the
248 # calendar - the sizes are hard-coded, however, and work best in landscape.
249 REM PS Border Border 5 sub moveto \
250 /SmallFont findfont 4 scalefont setfont \
251 (Sunrise: [sunrise($T)] Sunset: [sunset($T)]) show
252
253 # The next one puts the day number (1-366) and days left in the year at the
254 # bottom of the post-script calendar. Again, the hard-coded sizes work best
255 # in landscape.
256 FSET _DayOfYear(x) x-(date(year(x),1,1) - 1)
257 REM PS BoxWidth 3 mul 4 div Border 5 sub moveto \
258 /SmallFont findfont 4 scalefont setfont \
259 ([_DayOfYear($U)]([365+isleap($U)-_DayOfYear($U)])) show
260
261 #JHOLS
262 ##########################################################################
263 # #
264 # This portion of the file contains reminders for Jewish holidays. The #
265 # dates were obtained from "The First Jewish Catalog" by Richard Siegel #
266 # and Michael and Sharon Strassfeld, published by the Jewish Publication #
267 # Society of America. The Reform version of the calendar was guessed #
268 # at by Dianne Skoll based on experience. There is probably no standard #
269 # Reform position on many of the holidays, so you may have to adjust #
270 # the file as required. #
271 # #
272 # Additional corrections were made from the paper "Calendrical #
273 # Calculations" by Nachum Dershowitz and Edward M. Reingold. Any #
274 # further corrections are welcome. #
275 # #
276 ##########################################################################
277
278 # Here are some general functions that you might find nice to use
279
280 # _hstr: Returns a string which is the full Hebrew date of its argument.
281 # Example: hstr('1994/02/02') returns "21 Shvat 5754"
282 FSET _hstr(x) HEBDAY(x) + " " + HEBMON(x) + " " + HEBYEAR(x)
283
284 # _hyrlen: Return the length of the specified Hebrew year
285 # Example: _hyrlen(5754) returns 355
286 FSET _hyrlen(x) HEBDATE(1, "Tishrey", x+1) - HEBDATE(1, "Tishrey", x)
287
288 # --- HERE ARE THE JEWISH HOLIDAYS ---
289 # Set the variable InIsrael to 1 if you live in Israel. Otherwise,
290 # you get the Diaspora versions of Jewish holidays
291 SET InIsrael 0
292
293 # Set the variable Reform to 1 if you want the Reform version of the
294 # Jewish calendar. Otherwise, you get the traditional version
295 SET Reform 0
296
297 # Convenient function definition to save typing
298 FSET _h(x, y) HEBDATE(x,y)
299 FSET _h2(x, y) HEBDATE(x, y, $U-7)
300 FSET _PastSat(x, y) IIF(WKDAYNUM(_h2(x,y))!=6, _h2(x,y), _h2(x,y)+1)
301 FSET _PastSun(x, y) IIF(WKDAYNUM(_h2(x,y))!=0, _h2(x,y), _h2(x,y)+1)
302 FSET _PastMon(x, y) IIF(WKDAYNUM(_h2(x,y))!=1, _h2(x,y), _h2(x,y)+1)
303
304 # Default values in case InIsrael and Reform are not set
305 SET InIsrael VALUE("InIsrael", 0)
306 SET Reform VALUE("Reform", 0)
307
308 [_h(1, "Tishrey")] ++4 MSG %"Rosh Hashana 1%" is %b.
309
310 # No RH-2 or Tzom Gedalia in Reform
311 IF !Reform
312 [_h(2, "Tishrey")] ++4 MSG %"Rosh Hashana 2%" is %b.
313 [_PastSat(3, "Tishrey")] ++4 MSG %"Tzom Gedalia%" is %b.
314 ENDIF
315
316 [_h(10, "Tishrey")] ++4 MSG %"Yom Kippur%" is %b.
317 [_h(15, "Tishrey")] ++4 MSG %"Sukkot 1%" is %b.
318
319 IF !InIsrael
320 [_h(16, "Tishrey")] MSG %"Sukkot 2%"
321 ENDIF
322
323 [_h(21, "Tishrey")] ++4 MSG %"Hoshana Rabba%" is %b.
324 [_h(22, "Tishrey")] ++4 MSG %"Shemini Atzeret%" is %b.
325
326 IF InIsrael
327 [_h(22, "Tishrey")] ++4 MSG %"Simchat Torah%" is %b.
328 ELSE
329 [_h(23, "Tishrey")] ++4 MSG %"Simchat Torah%" is %b.
330 ENDIF
331
332 # Because Kislev can change length, we must be more careful about Chanukah
333 FSET _chan(x) HEBDATE(24, "Kislev", $U-9)+x
334 [_chan(1)] ++4 MSG %"Chanukah 1%" is %b.
335 [_chan(2)] MSG %"Chanukah 2%"
336 [_chan(3)] MSG %"Chanukah 3%"
337 [_chan(4)] MSG %"Chanukah 4%"
338 [_chan(5)] MSG %"Chanukah 5%"
339 [_chan(6)] MSG %"Chanukah 6%"
340 [_chan(7)] MSG %"Chanukah 7%"
341 [_chan(8)] MSG %"Chanukah 8%"
342
343 # Not sure about Reform's position on the next one.
344 IF !Reform
345 # 10 Tevet will never be a Saturday, so whether or not to
346 # move it is moot. (Thanks to Art Werschulz.)
347 [_h(10, "Tevet")] MSG %"Tzom Tevet%" is %b.
348 ENDIF
349
350 [_h(15, "Shvat")] ++4 MSG %"Tu B'Shvat%" is %b.
351 [_h(14, "Adar A")] ++4 MSG %"Purim Katan%" is %b.
352 [_h(15, "Adar A")] ++4 MSG %"Shushan Purim Katan%" is %b.
353
354 # If Purim is on Sunday, then Fast of Esther is 11 Adar.
355 IF WKDAYNUM(_h2(13, "Adar")) != 6
356 REM [_h2(13, "Adar")] ++4 MSG %"Fast of Esther%" is %b.
357 ELSE
358 REM [_h2(11, "Adar")] ++4 MSG %"Fast of Esther%" is %b.
359 ENDIF
360 [_h(14, "Adar")] ++4 MSG %"Purim%" is %b.
361 [_h(15, "Adar")] ++4 MSG %"Shushan Purim%" is %b.
362 [_h(15, "Nisan")] ++4 MSG %"Pesach%" is %b.
363
364 IF !InIsrael
365 [_h(16, "Nisan")] MSG %"Pesach 2%"
366 ENDIF
367
368 [_h(21, "Nisan")] MSG %"Pesach 7%"
369
370 IF !InIsrael && !Reform
371 [_h(22, "Nisan")] MSG %"Pesach 8%"
372 ENDIF
373
374 REM [_PastSun(27, "Nisan")] SATISFY 1
375
376 IF $Tw == 5
377 REM [_PastSun(26, "Nisan")] ++4 MSG %"Yom HaShoah%" is %b.
378 ELSE
379 REM [_PastSun(27, "Nisan")] ++4 MSG %"Yom HaShoah%" is %b.
380 ENDIF
381
382 # If 4 Iyar is a Thursday or Friday, then Yom Hazikaron is
383 # the Wednesday before and Yom Ha'atzmaut is on
384 # Thursday. If 4 Iyar is a Sunday, then Yom Hazikaron
385 # moves to 5 Iyar and Yom Ha'atzmaut to 6 Iyar.
386 IF WKDAYNUM(_h2(4, "Iyar")) == 4 || WKDAYNUM(_h2(4, "Iyar")) == 5
387 [_h(2, "Iyar")] ++4 MSG %"Yom Hazikaron%" is %b.
388 [_h(3, "Iyar")] ++4 MSG %"Yom Ha'atzmaut%" is %b.
389 ELSE
390 IF WKDAYNUM(_h2(4, "Iyar")) == 0
391 [_h(5, "Iyar")] ++4 MSG %"Yom Hazikaron%" is %b.
392 [_h(6, "Iyar")] ++4 MSG %"Yom Ha'atzmaut%" is %b.
393 ELSE
394 [_h(4, "Iyar")] ++4 MSG %"Yom Hazikaron%" is %b.
395 [_h(5, "Iyar")] ++4 MSG %"Yom Ha'atzmaut%" is %b.
396 ENDIF
397 ENDIF
398
399 # Not sure about Reform's position on Lag B'Omer
400 IF !Reform
401 [_h(18, "Iyar")] ++4 MSG %"Lag B'Omer%" is %b.
402 ENDIF
403
404 [_h(28, "Iyar")] ++4 MSG %"Yom Yerushalayim%" is %b.
405 [_h(6, "Sivan")] ++4 MSG %"Shavuot%" is %b.
406
407 IF !InIsrael && !Reform
408 [_h(7, "Sivan")] MSG %"Shavuot 2%"
409 ENDIF
410
411 # Fairly sure Reform Jews don't observe the next two
412 IF !Reform
413 # Tzom Tamuz and Tish'a B'Av are moved to Sunday if they normally
414 # fall on a Saturday
415 [_PastSat(17, "Tamuz")] ++4 MSG %"Tzom Tammuz%" is %b.
416 [_PastSat(9, "Av")] ++4 MSG %"Tish'a B'Av%" is %b.
417 ENDIF
418
419 # Counting the omer - do the whole spiel, i.e:
420 # "This is the xth day of the omer, being y weeks and z days of the omer."
421 # Nice Remind programming example here!
422 SET ostart HEBDATE(16, "Nisan", $U-50)
423 IF ostart <= $U && ($U - ostart < 49)
424 SET odays $U-ostart+1
425 IF odays < 7
426 MSG %"%"Today is the [ORD(odays)] day of the Omer.
427 ELSE
428 IF !(odays % 7)
429 MSG %"%"Today is the [ORD(odays)] day of the Omer, being [odays / 7] [PLURAL(odays/7, "week")] of the Omer.
430 ELSE
431 MSG %"%"Today is the [ORD(odays)] day of the Omer, being [odays/7] [PLURAL(odays/7, "week")] and [odays%7] [PLURAL(odays%7, "day")] of the Omer.
432 ENDIF
433 ENDIF
434 CAL [ORD(odays)] of Omer
435 ENDIF
436
437 ### Candle lighting and Havdalah. You should probably add candle lighting
438 ### for other holidays besides Shabbat. These just create calendar entries
439 ### for Friday and Saturday. Note: You must set your latitude, longitude
440 ### and possibly time zone for these to work properly!
441
442 REM Friday CAL Candle lighting at [sunset($T)-18]
443 REM Saturday CAL Havdalah at [sunset($T)+42]
444
445 #COLORS
446
447 # Examples
448 REM 1 SPECIAL COLOR 0 0 255 A blue reminder.
449 REM 2 SPECIAL COLOR 255 0 0 %"A red reminder%" safe to use in the calendar mode.
450
451 # The next examples are great for putting right at the end of the reminder
452 # file. They make queued reminders more eye-catching when they pop up.
453 FSET msgprefix(x) char(13,10,13,10)+"******************"+char(13,10,13,10)
454 FSET msgsuffix(x) char(13,10)+"******************"+char(13,10,13,10)