home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume40 / remind / patch10b < prev    next >
Encoding:
Text File  |  1993-10-25  |  59.7 KB  |  1,798 lines

  1. Newsgroups: comp.sources.misc
  2. From: dfs@doe.carleton.ca (David F. Skoll)
  3. Subject: v40i049:  remind - A replacement for calendar, Patch10b/3
  4. Message-ID: <1993Oct25.224730.7485@sparky.sterling.com>
  5. X-Md4-Signature: eb4eb85d1bdfe58f6958c3186c97b865
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Dept. of Electronics, Carleton University
  8. Date: Mon, 25 Oct 1993 22:47:30 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: dfs@doe.carleton.ca (David F. Skoll)
  12. Posting-number: Volume 40, Issue 49
  13. Archive-name: remind/patch10b
  14. Environment: UNIX, MS-DOS, OS/2
  15. Patch-To: remind: Volume 33, Issue 58-69
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  lnk.bcc makefile.bcc patch.10.A patch.10.C test-rem.bat
  22. #   test-rem.cmd
  23. # Wrapped by kent@sparky on Mon Oct 25 17:25:43 1993
  24. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  25. echo If this archive is complete, you will see the following message:
  26. echo '          "shar: End of archive 2 (of 3)."'
  27. if test -f 'lnk.bcc' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'lnk.bcc'\"
  29. else
  30.   echo shar: Extracting \"'lnk.bcc'\" \(205 characters\)
  31.   sed "s/^X//" >'lnk.bcc' <<'END_OF_FILE'
  32. Xcalendar.obj
  33. Xdorem.obj
  34. Xdosubst.obj
  35. Xexpr.obj
  36. Xfiles.obj
  37. Xfuncs.obj
  38. Xglobals.obj
  39. Xhbcal.obj
  40. Xinit.obj
  41. Xmain.obj
  42. Xmoon.obj
  43. Xomit.obj
  44. Xos2func.obj
  45. Xqueue.obj
  46. Xsort.obj
  47. Xtoken.obj
  48. Xtrigger.obj
  49. Xuserfns.obj
  50. Xutils.obj
  51. Xvar.obj
  52. END_OF_FILE
  53.   if test 205 -ne `wc -c <'lnk.bcc'`; then
  54.     echo shar: \"'lnk.bcc'\" unpacked with wrong size!
  55.   fi
  56.   # end of 'lnk.bcc'
  57. fi
  58. if test -f 'makefile.bcc' -a "${1}" != "-c" ; then 
  59.   echo shar: Will not clobber existing file \"'makefile.bcc'\"
  60. else
  61.   echo shar: Extracting \"'makefile.bcc'\" \(2567 characters\)
  62.   sed "s/^X//" >'makefile.bcc' <<'END_OF_FILE'
  63. X# Makefile for REMIND for Borland C++
  64. X
  65. XVERSION= 03.00.10
  66. X
  67. XMODEL=l
  68. X
  69. X!if $d(__OS2__)
  70. XCFLAGS= -DOS2 -w-pia -O2
  71. XBINDIR= ..\OS2-EX
  72. XDELFLAG= /f
  73. X!else
  74. XCFLAGS= -w-pia -O2 -m$(MODEL)
  75. XBINDIR= ..\MSDOS-EX
  76. XDELFLAG=
  77. X!endif
  78. X
  79. XHDRS= config.h err.h expr.h globals.h protos.h types.h version.h \
  80. Xlang.h english.h german.h dutch.h finnish.h french.h norwgian.h
  81. X
  82. XSTDHDRS= config.h types.h protos.h globals.h err.h lang.h
  83. X
  84. XLANGHDRS= english.h german.h dutch.h finnish.h french.h norwgian.h
  85. X
  86. XSRCS= calendar.c dorem.c dosubst.c expr.c files.c funcs.c globals.c init.c \
  87. Xmain.c omit.c sort.c token.c trigger.c userfns.c utils.c var.c hbcal.c \
  88. Xqueue.c moon.c os2func.c
  89. X
  90. XOBJS=calendar.obj dorem.obj dosubst.obj expr.obj files.obj funcs.obj \
  91. Xglobals.obj init.obj main.obj omit.obj sort.obj token.obj trigger.obj \
  92. Xutils.obj userfns.obj var.obj hbcal.obj queue.obj moon.obj os2func.obj
  93. X
  94. XMANIFEST= readme.uni readme.dos copyrigh $(HDRS) $(SRCS) makefile rem rem.1 \
  95. Xremind.1 remind-a.csh remind-a.sh test.rem test-rem test.cmp makefile.tc \
  96. Xmakefile.msc lnk.msc lnk.tc manifest.dos manifest.unx whatsnew.30 kall kall.1 \
  97. Xtstlang.rem defs.rem readme.os2 makefile.os2 rem2ps.c rem2ps.h remind.def \
  98. Xrem2ps.1 makefile.bcc lnk.bcc test-rem.cmd test2.cmp
  99. X
  100. Xall: exes test-rem.cmd test-rem.bat
  101. X    test-rem
  102. X
  103. Xclean:
  104. X    -del $(DELFLAG) *.obj
  105. X    -del $(DELFLAG) $(BINDIR)\*.exe
  106. X
  107. Xexes: $(BINDIR)\remind.exe $(BINDIR)\rem2ps.exe
  108. X
  109. X..\os2-ex\remind.exe: $(OBJS)
  110. X    bcc -e..\os2-ex\remind @lnk.bcc -lap;Toe
  111. X
  112. X..\msdos-ex\remind.exe: $(OBJS)
  113. X    bcc -e..\msdos-ex\remind -m$(MODEL) @lnk.bcc
  114. X
  115. X..\os2-ex\rem2ps.exe: rem2ps.obj
  116. X    bcc -e..\os2-ex\rem2ps rem2ps.obj -lap;Toe
  117. X
  118. X..\msdos-ex\rem2ps.exe: rem2ps.obj
  119. X    bcc -e..\msdos-ex\rem2ps -m$(MODEL) rem2ps.obj
  120. X
  121. X.c.obj:
  122. X    bcc $(CFLAGS) -c {$< }
  123. X
  124. Xrem2ps.obj: rem2ps.c rem2ps.h config.h lang.h
  125. X
  126. Xcalendar.obj: calendar.c $(STDHDRS) expr.h
  127. X
  128. Xdorem.obj: dorem.c $(STDHDRS) expr.h
  129. X
  130. Xdosubst.obj: dosubst.c $(STDHDRS) $(LANGHDRS)
  131. X
  132. Xexpr.obj: expr.c $(STDHDRS) expr.h
  133. X
  134. Xfiles.obj: files.c $(STDHDRS)
  135. X
  136. Xfuncs.obj: funcs.c $(STDHDRS) expr.h version.h
  137. X
  138. Xglobals.obj: globals.c config.h types.h globals.h err.h lang.h
  139. X
  140. Xinit.obj: init.c $(STDHDRS) expr.h version.h
  141. X
  142. Xmain.obj: main.c $(STDHDRS) expr.h
  143. X
  144. Xmoon.obj: moon.c $(STDHDRS) expr.h
  145. X
  146. Xomit.obj: omit.c $(STDHDRS)
  147. X
  148. Xos2func.obj: os2func.c $(STDHDRS)
  149. X
  150. Xqueue.obj: queue.c $(STDHDRS)
  151. X
  152. Xsort.obj: sort.c $(STDHDRS)
  153. X
  154. Xtoken.obj: token.c $(STDHDRS)
  155. X
  156. Xtrigger.obj: trigger.c $(STDHDRS) expr.h
  157. X
  158. Xuserfns.obj: userfns.c $(STDHDRS) expr.h
  159. X
  160. Xutils.obj: utils.c $(STDHDRS)
  161. X
  162. Xvar.obj: var.c $(STDHDRS) expr.h
  163. X
  164. Xremind.zoo: $(MANIFEST)
  165. X    zoo aI remind.zoo < manifest.dos
  166. X
  167. END_OF_FILE
  168.   if test 2567 -ne `wc -c <'makefile.bcc'`; then
  169.     echo shar: \"'makefile.bcc'\" unpacked with wrong size!
  170.   fi
  171.   # end of 'makefile.bcc'
  172. fi
  173. if test -f 'patch.10.A' -a "${1}" != "-c" ; then 
  174.   echo shar: Will not clobber existing file \"'patch.10.A'\"
  175. else
  176.   echo shar: Extracting \"'patch.10.A'\" \(558 characters\)
  177.   sed "s/^X//" >'patch.10.A' <<'END_OF_FILE'
  178. XThis is Official Patch 10 for Remind 3.0.  See WHATSNEW.30 for details
  179. XPrereq: "03.00.09"
  180. X*** ../prev/version.h    Tue Aug 31 13:22:25 1993
  181. X--- ./version.h    Wed Oct 20 14:47:27 1993
  182. X***************
  183. X*** 9,12 ****
  184. X  /*                                                             */
  185. X  /***************************************************************/
  186. X  
  187. X! #define VERSION "03.00.09"
  188. X--- 9,12 ----
  189. X  /*                                                             */
  190. X  /***************************************************************/
  191. X  
  192. X! #define VERSION "03.00.10"
  193. END_OF_FILE
  194.   if test 558 -ne `wc -c <'patch.10.A'`; then
  195.     echo shar: \"'patch.10.A'\" unpacked with wrong size!
  196.   elif test -f 'patch.10.B' && test -f 'patch.10.C'; then
  197.     echo shar: Combining  \"'patch.10'\" \(95017 characters\)
  198.     cat 'patch.10.A' 'patch.10.B' 'patch.10.C' > 'patch.10'
  199.     if test 95017 -ne `wc -c <'patch.10'`; then
  200.       echo shar: \"'patch.10'\" combined with wrong size!
  201.     else
  202.       rm patch.10.A patch.10.B patch.10.C
  203.     fi
  204.   fi
  205.   # end of 'patch.10.A'
  206. fi
  207. if test -f 'patch.10.C' -a "${1}" != "-c" ; then 
  208.   echo shar: Will not clobber existing file \"'patch.10.C'\"
  209. else
  210.   echo shar: Extracting \"'patch.10.C'\" \(50141 characters\)
  211.   sed "s/^X//" >'patch.10.C' <<'END_OF_FILE'
  212. X*** ../prev/makefile.os2    Mon Sep 20 15:00:08 1993
  213. X--- ./makefile.os2    Tue Oct 12 16:28:52 1993
  214. X***************
  215. X*** 25,31 ****
  216. X  # YOU SHOULDN'T EDIT ANYTHING BELOW HERE.  You may want to change some things
  217. X  # in config.h; then, you should be able to type 'make'.
  218. X  #-----------------------------------------------------------------------------
  219. X! VERSION= 03.00.09
  220. X  
  221. X  HDRS= config.h err.h expr.h globals.h protos.h types.h version.h \
  222. X  lang.h english.h german.h dutch.h finish.h french.h norwgian.h
  223. X--- 25,31 ----
  224. X  # YOU SHOULDN'T EDIT ANYTHING BELOW HERE.  You may want to change some things
  225. X  # in config.h; then, you should be able to type 'make'.
  226. X  #-----------------------------------------------------------------------------
  227. X! VERSION= 03.00.10
  228. X  
  229. X  HDRS= config.h err.h expr.h globals.h protos.h types.h version.h \
  230. X  lang.h english.h german.h dutch.h finish.h french.h norwgian.h
  231. X***************
  232. X*** 41,47 ****
  233. X  remind.1 remind-all.csh remind-all.sh test.rem test-rem test.cmp makefile.tc \
  234. X  makefile.msc lnk.msc lnk.tc MANIFEST.UNX MANIFEST.DOS WHATSNEW.30 kall kall.1 \
  235. X  defs.rem README.OS2 makefile.os2 rem2ps.c rem2ps.h remind.def rem2ps.1 \
  236. X! tstlang.rem
  237. X  
  238. X  OBJS= $(SRCS:.c=$O)
  239. X  
  240. X--- 41,49 ----
  241. X  remind.1 remind-all.csh remind-all.sh test.rem test-rem test.cmp makefile.tc \
  242. X  makefile.msc lnk.msc lnk.tc MANIFEST.UNX MANIFEST.DOS WHATSNEW.30 kall kall.1 \
  243. X  defs.rem README.OS2 makefile.os2 rem2ps.c rem2ps.h remind.def rem2ps.1 \
  244. X! tstlang.rem README.BCC lnk.bcc makefile.bcc os2func.c \
  245. X! test-rem.bat test-rem.cmd test1.cmp test2.cmp
  246. X! 
  247. X  
  248. X  OBJS= $(SRCS:.c=$O)
  249. X  
  250. X*** ../prev/makefile.tc    Thu Sep 30 15:50:25 1993
  251. X--- ./makefile.tc    Tue Oct 12 16:28:35 1993
  252. X***************
  253. X*** 1,6 ****
  254. X  # Makefile for REMIND for Turbo C for MSDOS
  255. X  
  256. X! VERSION= 03.00.09
  257. X  
  258. X  HDRS= config.h err.h expr.h globals.h protos.h types.h version.h \
  259. X  lang.h english.h german.h dutch.h finnish.h french.h norwgian.h
  260. X--- 1,7 ----
  261. X  # Makefile for REMIND for Turbo C for MSDOS
  262. X  
  263. X! CC= tcc
  264. X! VERSION= 03.00.10
  265. X  
  266. X  HDRS= config.h err.h expr.h globals.h protos.h types.h version.h \
  267. X  lang.h english.h german.h dutch.h finnish.h french.h norwgian.h
  268. X***************
  269. X*** 20,37 ****
  270. X  remind.1 remind-a.csh remind-a.sh test.rem test-rem test.cmp makefile.tc \
  271. X  makefile.msc lnk.msc lnk.tc manifest.dos manifest.unx whatsnew.30 kall kall.1 \
  272. X  tstlang.rem defs.rem readme.os2 makefile.os2 rem2ps.c rem2ps.h remind.def \
  273. X! rem2ps.1
  274. X  
  275. X  all: remind.exe rem2ps.exe
  276. X  
  277. X  remind.exe: $(OBJS)
  278. X!     tcc @lnk.tc
  279. X  
  280. X  rem2ps.exe: rem2ps.obj
  281. X!     tcc -erem2ps.exe rem2ps.obj
  282. X  
  283. X  .c.obj:
  284. X!     tcc -A -w-pia -c -O -mm {$< }
  285. X  
  286. X  rem2ps.obj: rem2ps.c rem2ps.h config.h lang.h
  287. X  
  288. X--- 21,40 ----
  289. X  remind.1 remind-a.csh remind-a.sh test.rem test-rem test.cmp makefile.tc \
  290. X  makefile.msc lnk.msc lnk.tc manifest.dos manifest.unx whatsnew.30 kall kall.1 \
  291. X  tstlang.rem defs.rem readme.os2 makefile.os2 rem2ps.c rem2ps.h remind.def \
  292. X! rem2ps.1 README.BCC lnk.bcc makefile.bcc os2func.c \
  293. X! test-rem.bat test-rem.cmd test1.cmp test2.cmp
  294. X  
  295. X+ 
  296. X  all: remind.exe rem2ps.exe
  297. X  
  298. X  remind.exe: $(OBJS)
  299. X!     $(CC) @lnk.tc
  300. X  
  301. X  rem2ps.exe: rem2ps.obj
  302. X!     $(CC) -erem2ps.exe rem2ps.obj
  303. X  
  304. X  .c.obj:
  305. X!     $(CC) -w-pia -c -O -mm {$< }
  306. X  
  307. X  rem2ps.obj: rem2ps.c rem2ps.h config.h lang.h
  308. X  
  309. X*** ../prev/moon.c    Thu Sep 30 15:50:08 1993
  310. X--- ./moon.c    Tue Oct 12 16:22:48 1993
  311. X***************
  312. X*** 274,288 ****
  313. X  double *usek;
  314. X  #endif
  315. X  {
  316. X-    int yy, mm, dd;
  317. X     double k, t, t2, t3, nt1;
  318. X  
  319. X!    jyear(sdate, &yy, &mm, &dd);
  320. X  
  321. X!    k = (yy + ((mm - 1) * (1.0 / 12.0)) - 1900) * 12.3685;
  322. X  
  323. X     /* Time in Julian centuries from 1900 January 0.5 */
  324. X!    t = (sdate - 2415020.0) / 36525;
  325. X     t2 = t * t;           /* Square for frequent use */
  326. X     t3 = t2 * t;           /* Cube for frequent use */
  327. X  
  328. X--- 274,291 ----
  329. X  double *usek;
  330. X  #endif
  331. X  {
  332. X     double k, t, t2, t3, nt1;
  333. X  
  334. X! /*** The following was the original code:  It gave roundoff errors
  335. X!      causing moonphase info to fail for Dec 1994.  ***/
  336. X! /*    jyear(sdate, &yy, &mm, &dd);
  337. X!       k = (yy + (mm/12.0) - 1900) * 12.368531; */
  338. X  
  339. X! /*** The next line is the replacement ***/
  340. X!    k = (sdate - 2415020.0) / synmonth;
  341. X  
  342. X     /* Time in Julian centuries from 1900 January 0.5 */
  343. X!    t = (sdate - 2415020.0) / 36525.0;
  344. X     t2 = t * t;           /* Square for frequent use */
  345. X     t3 = t2 * t;           /* Cube for frequent use */
  346. X  
  347. X***************
  348. X*** 316,322 ****
  349. X     int apcor = 0;
  350. X  
  351. X     k += phase;           /* Add phase to new moon time */
  352. X!    t = k / 1236.85;       /* Time in Julian centuries from
  353. X                       1900 January 0.5 */
  354. X     t2 = t * t;           /* Square for frequent use */
  355. X     t3 = t2 * t;           /* Cube for frequent use */
  356. X--- 319,325 ----
  357. X     int apcor = 0;
  358. X  
  359. X     k += phase;           /* Add phase to new moon time */
  360. X!    t = k / 1236.8531;       /* Time in Julian centuries from
  361. X                       1900 January 0.5 */
  362. X     t2 = t * t;           /* Square for frequent use */
  363. X     t3 = t2 * t;           /* Cube for frequent use */
  364. X***************
  365. X*** 602,616 ****
  366. X     int d1, t1;
  367. X     double k1, k2, jd, jdorig;
  368. X     double nt1, nt2;
  369. X     /* Convert from local to UTC */
  370. X     LocalToUTC(startdate, starttim, &utcd, &utct);
  371. X  
  372. X     /* Convert from Remind representation to year/mon/day */
  373. X     FromJulian(utcd, &y, &m, &d);
  374. X- 
  375. X     /* Convert to a true Julian date -- sorry for the name clashes! */
  376. X     jdorig = jtime(y, m, d, (utct / 60), (utct % 60), 0);   
  377. X!    jd = jdorig - 45;
  378. X     nt1 = meanphase(jd, 0.0, &k1);
  379. X     while(1) {
  380. X        jd += synmonth;
  381. X--- 605,619 ----
  382. X     int d1, t1;
  383. X     double k1, k2, jd, jdorig;
  384. X     double nt1, nt2;
  385. X+ 
  386. X     /* Convert from local to UTC */
  387. X     LocalToUTC(startdate, starttim, &utcd, &utct);
  388. X  
  389. X     /* Convert from Remind representation to year/mon/day */
  390. X     FromJulian(utcd, &y, &m, &d);
  391. X     /* Convert to a true Julian date -- sorry for the name clashes! */
  392. X     jdorig = jtime(y, m, d, (utct / 60), (utct % 60), 0);   
  393. X!    jd = jdorig - 45.0;
  394. X     nt1 = meanphase(jd, 0.0, &k1);
  395. X     while(1) {
  396. X        jd += synmonth;
  397. X*** ../prev/omit.c    Thu Aug 19 16:16:33 1993
  398. X--- ./omit.c    Tue Oct 12 16:22:49 1993
  399. X***************
  400. X*** 324,329 ****
  401. X--- 324,330 ----
  402. X       case T_Empty:
  403. X       case T_Comment:
  404. X       case T_RemType:
  405. X+      case T_Priority:
  406. X          parsing = 0;
  407. X          break;
  408. X  
  409. X***************
  410. X*** 353,359 ****
  411. X           NumFullOmits++;
  412. X        }
  413. X     }
  414. X!    if (tok.type == T_RemType) return E_PARSE_AS_REM;
  415. X     return OK;
  416. X  
  417. X  }
  418. X--- 354,360 ----
  419. X           NumFullOmits++;
  420. X        }
  421. X     }
  422. X!    if (tok.type == T_RemType || tok.type == T_Priority) return E_PARSE_AS_REM;
  423. X     return OK;
  424. X  
  425. X  }
  426. X*** ../prev/protos.h    Mon Sep 20 16:53:13 1993
  427. X--- ./protos.h    Wed Oct 20 11:54:30 1993
  428. X***************
  429. X*** 86,92 ****
  430. X  int PopOmitContext ARGS ((ParsePtr p));
  431. X  int IsOmitted ARGS ((int jul, int localomit));
  432. X  int DoOmit ARGS ((ParsePtr p));
  433. X! int QueueReminder ARGS ((ParsePtr p, int typ, TimeTrig *tim));
  434. X  void HandleQueuedReminders ARGS ((void));
  435. X  char *FindInitialToken ARGS ((Token *tok, char *s));
  436. X  void FindToken ARGS ((const char *s, Token *tok));
  437. X--- 86,92 ----
  438. X  int PopOmitContext ARGS ((ParsePtr p));
  439. X  int IsOmitted ARGS ((int jul, int localomit));
  440. X  int DoOmit ARGS ((ParsePtr p));
  441. X! int QueueReminder ARGS ((ParsePtr p, int typ, TimeTrig *tim, const char *sched));
  442. X  void HandleQueuedReminders ARGS ((void));
  443. X  char *FindInitialToken ARGS ((Token *tok, char *s));
  444. X  void FindToken ARGS ((const char *s, Token *tok));
  445. X***************
  446. X*** 113,119 ****
  447. X  unsigned int HashVal ARGS ((const char *str));
  448. X  int DateOK ARGS ((int y, int m, int d));
  449. X  Operator *FindFunc ARGS ((char *name, Operator where[], int num));
  450. X! int InsertIntoSortBuffer ARGS ((int jul, int tim, char *body, int typ));
  451. X  void IssueSortedReminders ARGS ((void));    
  452. X  int UserFuncExists ARGS ((char *fn));
  453. X  void JulToHeb ARGS((int jul, int *hy, int *hm, int *hd));
  454. X--- 113,119 ----
  455. X  unsigned int HashVal ARGS ((const char *str));
  456. X  int DateOK ARGS ((int y, int m, int d));
  457. X  Operator *FindFunc ARGS ((char *name, Operator where[], int num));
  458. X! int InsertIntoSortBuffer ARGS ((int jul, int tim, char *body, int typ, int prio));
  459. X  void IssueSortedReminders ARGS ((void));    
  460. X  int UserFuncExists ARGS ((char *fn));
  461. X  void JulToHeb ARGS((int jul, int *hy, int *hm, int *hd));
  462. X***************
  463. X*** 136,138 ****
  464. X--- 136,148 ----
  465. X  void UTCToLocal ARGS ((int utcdate, int utctime, int *locdate, int *loctime));
  466. X  int MoonPhase ARGS ((int date, int time));
  467. X  void HuntPhase ARGS ((int startdate, int starttim, int phas, int *date, int *time));
  468. X+ int CompareRems ARGS ((int dat1, int tim1, int prio1, int dat2, int tim2, int prio2, int bydate, int bytime, int byprio));
  469. X+ 
  470. X+ #if defined(__OS2__)
  471. X+ int fork ARGS ((void));
  472. X+ void StartPopUp ARGS ((void));
  473. X+ void EndPopUp ARGS ((void));
  474. X+ int PutcPopUp ARGS ((int c));
  475. X+ int PutlPopUp ARGS ((char *s));
  476. X+ int PutsPopUp ARGS ((char *s));
  477. X+ #endif
  478. X*** ../prev/queue.c    Thu Aug 19 16:12:20 1993
  479. X--- ./queue.c    Wed Oct 20 13:16:43 1993
  480. X***************
  481. X*** 22,31 ****
  482. X--- 22,39 ----
  483. X  #ifdef HAVE_UNISTD
  484. X  #include <unistd.h>
  485. X  #endif
  486. X+ 
  487. X+ #ifdef __BORLANDC__
  488. X+ #include <io.h>
  489. X+ #include <dos.h>
  490. X+ #include <process.h>
  491. X+ #endif
  492. X+ 
  493. X  #include "globals.h"
  494. X  #include "err.h"
  495. X  #include "types.h"
  496. X  #include "protos.h"
  497. X+ #include "expr.h"
  498. X  
  499. X  /* List structure for holding queued reminders */
  500. X  typedef struct queuedrem {
  501. X***************
  502. X*** 32,38 ****
  503. X--- 40,48 ----
  504. X     struct queuedrem *next;
  505. X     int typ;
  506. X     int RunDisabled;
  507. X+    int ntrig;
  508. X     char *text;
  509. X+    char sched[VAR_NAME_LEN+1];
  510. X     TimeTrig tt;
  511. X  } QueuedRem;
  512. X  
  513. X***************
  514. X*** 45,51 ****
  515. X--- 55,67 ----
  516. X  PRIVATE void CheckInitialFile ARGS ((void));
  517. X  PRIVATE int CalculateNextTime ARGS ((QueuedRem *q));
  518. X  PRIVATE QueuedRem *FindNextReminder ARGS ((void));
  519. X+ PRIVATE int CalculateNextTimeUsingSched ARGS ((QueuedRem *q));
  520. X+ 
  521. X+ #ifdef __OS2__
  522. X+ void (__cdecl SigIntHandler(int));
  523. X+ #else
  524. X  PRIVATE void SigIntHandler ARGS ((void));
  525. X+ #endif
  526. X  
  527. X  /***************************************************************/
  528. X  /*                                                             */
  529. X***************
  530. X*** 56,67 ****
  531. X  /*                                                             */
  532. X  /***************************************************************/
  533. X  #ifdef HAVE_PROTOS
  534. X! PUBLIC int QueueReminder(ParsePtr p, int typ, TimeTrig *tim)
  535. X  #else
  536. X! int QueueReminder(p, typ, tim)
  537. X  ParsePtr p;
  538. X  int typ;
  539. X  TimeTrig *tim;
  540. X  #endif
  541. X  {
  542. X     QueuedRem *qelem;
  543. X--- 72,84 ----
  544. X  /*                                                             */
  545. X  /***************************************************************/
  546. X  #ifdef HAVE_PROTOS
  547. X! PUBLIC int QueueReminder(ParsePtr p, int typ, TimeTrig *tim, const char *sched)
  548. X  #else
  549. X! int QueueReminder(p, typ, tim, sched)
  550. X  ParsePtr p;
  551. X  int typ;
  552. X  TimeTrig *tim;
  553. X+ char *sched;
  554. X  #endif
  555. X  {
  556. X     QueuedRem *qelem;
  557. X***************
  558. X*** 85,90 ****
  559. X--- 102,109 ----
  560. X     qelem->tt = *tim;
  561. X     qelem->next = QueueHead;
  562. X     qelem->RunDisabled = RunDisabled;
  563. X+    qelem->ntrig = 0;
  564. X+    strcpy(qelem->sched, sched);
  565. X     QueueHead = qelem;
  566. X     NumQueued++;
  567. X     return OK;
  568. X***************
  569. X*** 191,196 ****
  570. X--- 210,218 ----
  571. X  /*                                                             */
  572. X  /*  Calculate the next time when a reminder should be issued.  */
  573. X  /*  Return NO_TIME if reminder expired.                        */
  574. X+ /*  Strategy is:  If a sched() function is defined, call it.   */
  575. X+ /*  Otherwise, use AT time with delta and rep.  If sched()     */
  576. X+ /*  fails, revert to AT with delta and rep.                    */
  577. X  /*                                                             */
  578. X  /***************************************************************/
  579. X  #ifdef HAVE_PROTOS
  580. X***************
  581. X*** 204,210 ****
  582. X--- 226,239 ----
  583. X     int rep = q->tt.rep;
  584. X     int delta = q->tt.delta;
  585. X     int curtime = q->tt.nexttime+1;
  586. X+    int r;
  587. X  
  588. X+ /* Increment number of times this one has been triggered */
  589. X+    q->ntrig++;
  590. X+    if (q->sched[0]) {
  591. X+       r = CalculateNextTimeUsingSched(q);
  592. X+       if (r != NO_TIME) return r;
  593. X+    }
  594. X     if (delta == NO_DELTA)
  595. X        if (tim < curtime) return NO_TIME; else return tim;
  596. X  
  597. X***************
  598. X*** 253,263 ****
  599. X--- 282,296 ----
  600. X  /* command-line flag is supplied.                              */
  601. X  /*                                                             */
  602. X  /***************************************************************/
  603. X+ #ifdef __OS2__
  604. X+ void __cdecl SigIntHandler(int d)
  605. X+ #else
  606. X  #ifdef HAVE_PROTOS
  607. X  PRIVATE void SigIntHandler(void)
  608. X  #else
  609. X  static void SigIntHandler()
  610. X  #endif
  611. X+ #endif
  612. X  {
  613. X     QueuedRem *q = QueueHead;
  614. X  
  615. X***************
  616. X*** 269,278 ****
  617. X  
  618. X     while (q) {
  619. X        if (q->tt.nexttime != NO_TIME) {
  620. X!          printf("Trigger: %02d%c%02d  Activate: %02d%c%02d  Rep: %d  Delta: %d%s",
  621. X                   q->tt.ttime / 60, TIMESEP, q->tt.ttime % 60,
  622. X                   q->tt.nexttime / 60, TIMESEP, q->tt.nexttime % 60,
  623. X!                  q->tt.rep, q->tt.delta, NL);
  624. X                   printf("Text: %s %s%s%s", ((q->typ == MSG_TYPE) ? "MSG" :
  625. X                                     ((q->typ == MSF_TYPE) ? "MSF" :"RUN")),
  626. X                   q->text,
  627. X--- 302,311 ----
  628. X  
  629. X     while (q) {
  630. X        if (q->tt.nexttime != NO_TIME) {
  631. X!          printf("Trigger: %02d%c%02d  Activate: %02d%c%02d  Rep: %d  Delta: %d  Sched: %s%s",
  632. X                   q->tt.ttime / 60, TIMESEP, q->tt.ttime % 60,
  633. X                   q->tt.nexttime / 60, TIMESEP, q->tt.nexttime % 60,
  634. X!                  q->tt.rep, q->tt.delta, q->sched, NL);
  635. X                   printf("Text: %s %s%s%s", ((q->typ == MSG_TYPE) ? "MSG" :
  636. X                                     ((q->typ == MSF_TYPE) ? "MSF" :"RUN")),
  637. X                   q->text,
  638. X***************
  639. X*** 306,308 ****
  640. X--- 339,401 ----
  641. X            execvp(ArgV[0], ArgV);
  642. X  }
  643. X  
  644. X+ /***************************************************************/
  645. X+ /*                                                             */
  646. X+ /*  CalculateNextTimeUsingSched                                */
  647. X+ /*                                                             */
  648. X+ /*  Call the scheduling function.                              */
  649. X+ /*                                                             */
  650. X+ /***************************************************************/
  651. X+ #ifdef HAVE_PROTOS
  652. X+ PRIVATE int CalculateNextTimeUsingSched(QueuedRem *q)
  653. X+ #else
  654. X+ static int CalculateNextTimeUsingSched(q)
  655. X+ QueuedRem *q;
  656. X+ #endif
  657. X+ {
  658. X+    /* Use LineBuffer for temp. string storage. */
  659. X+    int r;
  660. X+    Value v;
  661. X+    char *s;
  662. X+    int LastTime = -1;
  663. X+    int ThisTime;
  664. X+ 
  665. X+    if (UserFuncExists(q->sched) != 1) {
  666. X+       q->sched[0] = 0;
  667. X+       return NO_TIME;
  668. X+    }
  669. X+ 
  670. X+    RunDisabled = q->RunDisabled;  /* Don't want weird scheduling functions
  671. X+                      to be a security hole!                */
  672. X+    while(1) {
  673. X+       sprintf(LineBuffer, "%s(%d)", q->sched, q->ntrig);
  674. X+       s = LineBuffer;
  675. X+       r = EvalExpr(&s, &v);
  676. X+       if (r) {
  677. X+          q->sched[0] = 0;
  678. X+          return NO_TIME;
  679. X+       }
  680. X+       if (v.type == TIM_TYPE) {
  681. X+          ThisTime = v.v.val;
  682. X+       } else if (v.type == INT_TYPE) {
  683. X+          if (v.v.val > 0) 
  684. X+         ThisTime = q->tt.nexttime + v.v.val;
  685. X+          else
  686. X+         ThisTime = q->tt.ttime + v.v.val;
  687. X+ 
  688. X+       } else {
  689. X+          DestroyValue(&v);
  690. X+      q->sched[0] = 0;
  691. X+      return NO_TIME;
  692. X+       }
  693. X+       if (ThisTime < 0) ThisTime = 0;        /* Can't be less than 00:00 */
  694. X+       if (ThisTime > 1439) ThisTime = 1439;  /* or greater than 11:59 */
  695. X+       if (ThisTime > q->tt.nexttime) return ThisTime;
  696. X+       if (ThisTime <= LastTime) {
  697. X+          q->sched[0] = 0;
  698. X+      return NO_TIME;
  699. X+       }
  700. X+       LastTime = ThisTime;
  701. X+       q->ntrig++;
  702. X+    }
  703. X+ }
  704. X*** ../prev/rem2ps.c    Tue Sep 28 12:33:59 1993
  705. X--- ./rem2ps.c    Wed Oct 13 10:46:21 1993
  706. X***************
  707. X*** 24,29 ****
  708. X--- 24,33 ----
  709. X  #include <stdlib.h>
  710. X  #endif
  711. X  
  712. X+ #ifdef __TURBOC__
  713. X+ #include <io.h>
  714. X+ #endif
  715. X+ 
  716. X  #ifdef HAVE_PROTOS
  717. X  #define ARGS(x) x
  718. X  #else
  719. X***************
  720. X*** 183,189 ****
  721. X     int is_ps;
  722. X     CalEntry *c, *d;
  723. X  
  724. X-    printf("%%%%Page: %d %d\n", validfile, validfile);
  725. X  /* Read the month and year name, followed by # days in month and 1st day of
  726. X     month, followed by the MondayFirst flag */
  727. X     gets(LineBuffer);
  728. X--- 187,192 ----
  729. X***************
  730. X*** 195,200 ****
  731. X--- 198,206 ----
  732. X     MaxDay = days;
  733. X     FirstWkDay = wkday;
  734. X  
  735. X+    printf("%%%%Page: %c%c%c%c%c %d\n", month[0], month[1], month[2],
  736. X+              year[2], year[3], validfile);
  737. X+ 
  738. X  /* Emit PostScript to do the heading */
  739. X     if (!PortraitMode) printf("XSIZE 0 translate 90 rotate\n");
  740. X     printf("/SAVESTATE save def (%s) (%s) PreCal SAVESTATE restore\n", month, year);
  741. X***************
  742. X*** 255,262 ****
  743. X        if (is_ps) {
  744. X  /* Save the 'P' or 'F' flag */
  745. X           *(c->entry) = *LineBuffer;
  746. X!      c->next = PsEntries[DayNum];
  747. X!      PsEntries[DayNum] = c;
  748. X        } else {
  749. X  /* Put on linked list */
  750. X           if (!CurEntries) CurEntries = c;
  751. X--- 261,272 ----
  752. X        if (is_ps) {
  753. X  /* Save the 'P' or 'F' flag */
  754. X           *(c->entry) = *LineBuffer;
  755. X!          if (!PsEntries[DayNum]) PsEntries[DayNum] = c;
  756. X!      else {
  757. X!         d = PsEntries[DayNum];
  758. X!         while(d->next) d = d->next;
  759. X!         d->next = c;
  760. X!          }
  761. X        } else {
  762. X  /* Put on linked list */
  763. X           if (!CurEntries) CurEntries = c;
  764. X*** ../prev/remind.1    Thu Sep 30 15:25:03 1993
  765. X--- ./remind.1    Wed Oct 20 13:27:12 1993
  766. X***************
  767. X*** 1,4 ****
  768. X! .TH REMIND 1 "30 September 1993"
  769. X  .UC 4
  770. X  .SH NAME
  771. X  remind \- a sophisticated reminder service
  772. X--- 1,4 ----
  773. X! .TH REMIND 1 "13 October 1993"
  774. X  .UC 4
  775. X  .SH NAME
  776. X  remind \- a sophisticated reminder service
  777. X***************
  778. X*** 119,130 ****
  779. X  Echo lines when displaying error messages
  780. X  .RE
  781. X  .TP
  782. X! \fB\-g\fR[\fBa|d\fR[\fBa|d\fR]]
  783. X  Normally, reminders are issued in the order in which they are encountered
  784. X  in the reminder script.  The \fB\-g\fR option cause \fBRemind\fR to
  785. X  sort reminders by date and time prior to issuing them.  The optional
  786. X  \fBa\fR and \fBd\fR characters specify the sort order (ascending or
  787. X! descending) for the date and time fields.  See the section "Sorting
  788. X  Reminders" for more information.
  789. X  .TP
  790. X  \fB\-b\fR[\fIn\fR]
  791. X--- 119,130 ----
  792. X  Echo lines when displaying error messages
  793. X  .RE
  794. X  .TP
  795. X! \fB\-g\fR[\fBa|d\fR[\fBa|d\fR[\fBa|d\fR]]]
  796. X  Normally, reminders are issued in the order in which they are encountered
  797. X  in the reminder script.  The \fB\-g\fR option cause \fBRemind\fR to
  798. X  sort reminders by date and time prior to issuing them.  The optional
  799. X  \fBa\fR and \fBd\fR characters specify the sort order (ascending or
  800. X! descending) for the date, time and priority fields.  See the section "Sorting
  801. X  Reminders" for more information.
  802. X  .TP
  803. X  \fB\-b\fR[\fIn\fR]
  804. X***************
  805. X*** 257,265 ****
  806. X--- 257,267 ----
  807. X  [\fIback\fR]
  808. X  [\fIdelta\fR]
  809. X  [\fIrepeat\fR]
  810. X+ [\fBPRIORITY\fR \fIprio\fR]
  811. X  [\fBSKIP\fR | \fBBEFORE\fR | \fBAFTER\fR]
  812. X  [\fBOMIT\fR \fIomit_list\fR]
  813. X  [\fBAT\fR \fItime\fR [\fItdelta\fR] [\fItrepeat\fR]]
  814. X+ [\fBSCHED\fR \fIsched_function\fR]
  815. X  [\fBUNTIL\fR \fIexpiry_date\fR]
  816. X  [\fBSCANFROM\fR \fIscan_date\fR]
  817. X  \fBMSG\fR | \fBMSF\fR | \fBRUN\fR | \fBCAL\fR | \fBSATISFY\fR |
  818. X***************
  819. X*** 602,607 ****
  820. X--- 604,617 ----
  821. X  near the end of this manual.  Note that \fBSCANFROM\fR is available only
  822. X  in versions of \fBRemind\fR from 03.00.04 up.
  823. X  .PP
  824. X+ .B PRIORITY
  825. X+ .PP
  826. X+ The \fBPRIORITY\fR keyword must be followed by a number from 0 to 9999.
  827. X+ It is used in calendar mode and when sorting reminders.  If two reminders
  828. X+ have the same trigger date and time, then they are sorted by priority.
  829. X+ If the \fBPRIORITY\fR keyword is not supplied, a default priority of 5000
  830. X+ is used.
  831. X+ .PP
  832. X  .B EXPIRY DATES
  833. X  .PP
  834. X  Some reminders should be issued periodically for a certain time, but then
  835. X***************
  836. X*** 767,772 ****
  837. X--- 777,789 ----
  838. X  \fInot\fR necessarily be those which were in effect at the time the reminder
  839. X  was queued.
  840. X  .PP
  841. X+ .B THE SCHED KEYWORD
  842. X+ .PP
  843. X+ The \fBSCHED\fR keyword allows more precise control over the triggering
  844. X+ of timed reminders.  However, discussion must be deferred until after
  845. X+ expressions and user-defined functions are explained.  See the subsection
  846. X+ "Precise Scheduling" further on.
  847. X+ .PP
  848. X  .SH THE SUBSTITUTION FILTER
  849. X  .PP
  850. X  Before being processed, the body of a
  851. X***************
  852. X*** 1503,1512 ****
  853. X  .TP
  854. X  .B $CalcUTC 
  855. X  If 1 (the default), then \fBRemind\fR uses C library functions
  856. X! to calculate the number of minutes between local and universal time.
  857. X  This affects astronomical calculations (\fBsunrise()\fR for example.)
  858. X  If 0, then you must supply the number of minutes between local and
  859. X! universal time in the \fB$MinsFromUTC\fR system variable.
  860. X  .TP
  861. X  .B $CalMode (read-only)
  862. X  If non-zero, then the \fB\-c\fR option was supplied on the command line.
  863. X--- 1520,1530 ----
  864. X  .TP
  865. X  .B $CalcUTC 
  866. X  If 1 (the default), then \fBRemind\fR uses C library functions
  867. X! to calculate the number of minutes between local and Universal Time
  868. X! Coordinated.
  869. X  This affects astronomical calculations (\fBsunrise()\fR for example.)
  870. X  If 0, then you must supply the number of minutes between local and
  871. X! Universal Time Coordinated in the \fB$MinsFromUTC\fR system variable.
  872. X  .TP
  873. X  .B $CalMode (read-only)
  874. X  If non-zero, then the \fB\-c\fR option was supplied on the command line.
  875. X***************
  876. X*** 1613,1619 ****
  877. X  (described later.)  Must be at least 10.
  878. X  .TP
  879. X  .B $MinsFromUTC
  880. X! The number of minutes between Universal Time and local time.  If
  881. X  \fB$CalcUTC\fR is non-zero, this is calculated upon startup of \fBRemind\fR.
  882. X  Otherwise, you must set it explicitly.  If \fB$CalcUTC\fR is zero,
  883. X  then \fB$MinsFromUTC\fR is used in the astronomical calculations.  You
  884. X--- 1631,1637 ----
  885. X  (described later.)  Must be at least 10.
  886. X  .TP
  887. X  .B $MinsFromUTC
  888. X! The number of minutes between Universal Time Coordinated and local time.  If
  889. X  \fB$CalcUTC\fR is non-zero, this is calculated upon startup of \fBRemind\fR.
  890. X  Otherwise, you must set it explicitly.  If \fB$CalcUTC\fR is zero,
  891. X  then \fB$MinsFromUTC\fR is used in the astronomical calculations.  You
  892. X***************
  893. X*** 1656,1661 ****
  894. X--- 1674,1691 ----
  895. X  Set to a non-zero value if \fIeither\fR of the \fB\-p\fR or \fB\-s\fR
  896. X  command-line options was supplied.
  897. X  .TP
  898. X+ .B $SortByDate (read-only)
  899. X+ Set to 0 if no \fB\-g\fR option is used, 1 if sorting by date in ascending
  900. X+ order, or 2 if sorting by date in descending order.
  901. X+ .TP
  902. X+ .B $SortByPrio (read-only)
  903. X+ Set to 0 if no \fB\-g\fR option is used, 1 if sorting by priority in ascending
  904. X+ order, or 2 if sorting by priority in descending order.
  905. X+ .TP
  906. X+ .B $SortByTime (read-only)
  907. X+ Set to 0 if no \fB\-g\fR option is used, 1 if sorting by time in ascending
  908. X+ order, or 2 if sorting by time in descending order.
  909. X+ .TP
  910. X  .B $SubsIndent
  911. X  The number of spaces by which all lines (except the first) of an
  912. X  \fBMSF\fR-type reminder should be indented.  The default is 0.
  913. X***************
  914. X*** 1935,1944 ****
  915. X  as with the < operator.
  916. X  .TP
  917. X  .B minsfromutc([d_date [,t_time]])
  918. X! Returns the number of minutes from Universal Time (formerly GMT) to
  919. X  local time on the specified date and time.  \fIDate\fR defaults to
  920. X  \fBtoday()\fR and \fItime\fR defaults to midnight.  If local time
  921. X! is before UT, the result is negative.  Otherwise, the result is
  922. X  positive.
  923. X  .RS
  924. X  .PP
  925. X--- 1965,1975 ----
  926. X  as with the < operator.
  927. X  .TP
  928. X  .B minsfromutc([d_date [,t_time]])
  929. X! Returns the number of minutes from Universal Time Coordinated 
  930. X! (formerly GMT) to
  931. X  local time on the specified date and time.  \fIDate\fR defaults to
  932. X  \fBtoday()\fR and \fItime\fR defaults to midnight.  If local time
  933. X! is before UTC, the result is negative.  Otherwise, the result is
  934. X  positive.
  935. X  .RS
  936. X  .PP
  937. X***************
  938. X*** 1982,1989 ****
  939. X  quarter, 2 full moon, and 3 third quarter.  If \fIdate\fR is omitted,
  940. X  it defaults to \fBtoday()\fR.  If \fItime\fR is omitted, it defaults
  941. X  to midnight.  \fBMoontime()\fR is intended to be used in conjunction
  942. X! with \fBmoondate()\fR.  Don't take the time too seriously - it's only
  943. X! accurate to within 15-20 minutes.
  944. X  .RS
  945. X  .PP
  946. X  For example, the following returns the date and time of the next full moon:
  947. X--- 2013,2021 ----
  948. X  quarter, 2 full moon, and 3 third quarter.  If \fIdate\fR is omitted,
  949. X  it defaults to \fBtoday()\fR.  If \fItime\fR is omitted, it defaults
  950. X  to midnight.  \fBMoontime()\fR is intended to be used in conjunction
  951. X! with \fBmoondate()\fR.  The \fBmoondate()\fR and \fBmoontime()\fR
  952. X! functions are accurate to within a couple of minutes of the
  953. X! times in "Old Farmer's Almanac" for Ottawa, Ontario.
  954. X  .RS
  955. X  .PP
  956. X  For example, the following returns the date and time of the next full moon:
  957. X***************
  958. X*** 2122,2131 ****
  959. X  or \fBIFTRIG\fR command.  If used
  960. X  in the \fIbody\fR of a \fBREM\fR command, returns that command's trigger date.
  961. X  .TP
  962. X! .B trigger(d_date)
  963. X  Returns a string suitable for use in a \fBREM\fR command, allowing you to
  964. X! calculate trigger dates in advance.  See the section "Expression pasting"
  965. X! for more information.
  966. X  .TP
  967. X  .B trigtime()
  968. X  Returns the time of the last \fBREM\fR command with an \fBAT\fR clause.
  969. X--- 2154,2181 ----
  970. X  or \fBIFTRIG\fR command.  If used
  971. X  in the \fIbody\fR of a \fBREM\fR command, returns that command's trigger date.
  972. X  .TP
  973. X! .B trigger(d_date [,t_time [,i_utcflag]])
  974. X  Returns a string suitable for use in a \fBREM\fR command, allowing you to
  975. X! calculate trigger dates in advance.  (See the section "Expression pasting"
  976. X! for more information.)  Normally, the \fIdate\fR and \fItime\fR are
  977. X! the local date and time; however, if \fIutcflag\fR is non-zero, the
  978. X! \fIdate\fR and \fItime\fR are interpreted as UTC times, and are
  979. X! converted to local time.  Examples:
  980. X! .RS
  981. X! .PP
  982. X! trigger('1993/04/01')
  983. X! .PP
  984. X! returns "1 April 1993",
  985. X! .PP
  986. X! trigger('1994/08/09', 12:33)
  987. X! .PP
  988. X! returns "9 August 1994 AT 12:33", and
  989. X! .PP
  990. X! trigger('1994/12/01', 03:00, 1)
  991. X! .PP
  992. X! returns "30 November 1994 AT 22:00" for EST, which is 5 hours behind UTC.
  993. X! The value for your time zone may differ.
  994. X! .RE
  995. X  .TP
  996. X  .B trigtime()
  997. X  Returns the time of the last \fBREM\fR command with an \fBAT\fR clause.
  998. X***************
  999. X*** 2410,2415 ****
  1000. X--- 2460,2533 ----
  1001. X  functions), you may wish to name all user-defined functions beginning
  1002. X  with an underscore.
  1003. X  .PP
  1004. X+ .SH PRECISE SCHEDULING
  1005. X+ .PP
  1006. X+ The \fBSCHED\fR keyword allows precise control over the scheduling of timed
  1007. X+ reminders.  It should be followed by the name of a user-defined function,
  1008. X+ \fIsched_function\fR.
  1009. X+ .PP
  1010. X+ If a scheduling function is supplied, then it must take one argument of
  1011. X+ type \fBINT\fR.  Rather than using the \fBAT\fR time, time \fIdelta\fR, and
  1012. X+ time \fIrepeat\fR, \fBRemind\fR calls the scheduling function to determine
  1013. X+ when to trigger the reminder.  The first time the reminder is queued, the
  1014. X+ scheduling function is called with an argument of 1.  Each time the reminder
  1015. X+ is triggered, it is re-scheduled by calling the scheduling function again.
  1016. X+ On each call, the argument is incremented by one.
  1017. X+ .PP
  1018. X+ The return value of the scheduling function must be an \fBINT\fR or a
  1019. X+ \fBTIME\fR.  If the return value is a \fBTIME\fR, then the reminder is
  1020. X+ re-queued to trigger at that time.  If it is a positive integer \fIn\fR,
  1021. X+ then the reminder is re-queued to trigger at the previous trigger time
  1022. X+ plus \fIn\fR minutes.  Finally, if it is a negative integer or zero, then
  1023. X+ the reminder is re-queued to trigger \fIn\fR minutes before the \fBAT\fR
  1024. X+ time.  Note that there must be an \fBAT\fR clause for the \fBSCHED\fR
  1025. X+ clause to do anything.
  1026. X+ .PP
  1027. X+ Here's an example:
  1028. X+ .PP
  1029. X+ .nf
  1030. X+     FSET _sfun(x) choose(x, -60, 30, 15, 10, 3, 1, 1, 1, 1, 0)
  1031. X+     REM AT 13:00 SCHED _sfun MSG foo
  1032. X+ .fi
  1033. X+ .PP
  1034. X+ The reminder would first be triggered at 13:00-60 minutes, or at 12:00.
  1035. X+ It would next be triggered 30 minutes later, at 12:30.  Then, it would
  1036. X+ be triggered at 12:45, 12:55, 12:58, 12:59, 13:00, 13:01 and 13:02.
  1037. X+ .PP
  1038. X+ .B NOTES
  1039. X+ .TP
  1040. X+ 1
  1041. X+ If an error occurs during the evaluation of \fIsched_func\fR, then
  1042. X+ \fBRemind\fR reverts to using the \fBAT\fR time and the \fIdelta\fR
  1043. X+ and \fIrepeat\fR values, and never calls \fIsched_func\fR again.
  1044. X+ .TP
  1045. X+ 2
  1046. X+ If processing \fIsched_func\fR yields a time earlier than the current
  1047. X+ system time, it is repeatedly called with increasing argument until it
  1048. X+ yields a value greater than or equal to the current time.  However, if
  1049. X+ the sequence of values calculated during the repetition is not strictly
  1050. X+ increasing, then \fBRemind\fR reverts to the default behaviour and
  1051. X+ never calls \fIsched_func\fR again.
  1052. X+ .TP
  1053. X+ 3
  1054. X+ It is quite possible using \fIsched_func\fR to keep triggering a reminder
  1055. X+ even after the \fBAT\fR-time.  However, it is not possible to reschedule
  1056. X+ a reminder past midnight \- no crossing of date boundaries is allowed.
  1057. X+ Also, it is quite possible to \fBnot\fR trigger a reminder on the \fBAT\fR
  1058. X+ time when you use a scheduling function.  However, if your scheduling
  1059. X+ function is terminated (for reasons 1 and 2) before the \fBAT\fR time of
  1060. X+ the reminder, it \fIwill\fR be triggered at the \fBAT\fR time, because
  1061. X+ normal processing takes over.
  1062. X+ .TP
  1063. X+ 4
  1064. X+ Your scheduling functions should (as a matter of good style) return
  1065. X+ 0 when no more scheduling is required.  See the example.
  1066. X+ .TP
  1067. X+ 5
  1068. X+ All scheduling functions are evaluated \fIafter\fR the entire Remind
  1069. X+ script has been read in.  So whatever function definitions are in effect
  1070. X+ at the end of the script are used.
  1071. X+ .PP
  1072. X  .SH THE SATISFY CLAUSE
  1073. X  .PP
  1074. X  The form of \fBREM\fR which uses \fBSATISFY\fR is as follows:
  1075. X***************
  1076. X*** 2699,2705 ****
  1077. X  Timed reminders are sorted and placed into the calendar in time order.
  1078. X  These are followed by non-timed reminders.  \fBRemind\fR automatically
  1079. X  places the time of timed reminders in the calendar according to the
  1080. X! \fB\-b\fR command-line option.
  1081. X  .PP
  1082. X  .B REPEATED EXECUTION
  1083. X  .PP
  1084. X--- 2817,2826 ----
  1085. X  Timed reminders are sorted and placed into the calendar in time order.
  1086. X  These are followed by non-timed reminders.  \fBRemind\fR automatically
  1087. X  places the time of timed reminders in the calendar according to the
  1088. X! \fB\-b\fR command-line option.  Reminders in calendar mode are sorted as
  1089. X! if the \fB\-g\fR option had been used; you can change the sort order
  1090. X! in calendar mode by explicitly using the \fB\-g\fR option to specify
  1091. X! a different order from the default.
  1092. X  .PP
  1093. X  .B REPEATED EXECUTION
  1094. X  .PP
  1095. X***************
  1096. X*** 2763,2770 ****
  1097. X  the PostScript output.
  1098. X  .PP
  1099. X  The PostScript-type reminders for a particular day are included in the
  1100. X! PostScript output in the same order they were triggered in the \fBRemind\fR
  1101. X! script file.  All of the PostScript code for a particular date is enclosed
  1102. X  in a \fBsave\fR-\fBrestore\fR pair.  However, if several PostScript-type
  1103. X  reminders are triggered for a single day, each section of PostScript is
  1104. X  not enclosed in a \fBsave\fR-\fBrestore\fR pair - instead, the entire
  1105. X--- 2884,2902 ----
  1106. X  the PostScript output.
  1107. X  .PP
  1108. X  The PostScript-type reminders for a particular day are included in the
  1109. X! PostScript output in sorted order of priority.  Note that the order
  1110. X! of PostScript commands has a \fImajor\fR impact on the appearance of the
  1111. X! calendars.  For example, PostScript code to shade a calendar box will
  1112. X! obliterate code to draw a moon symbol if the moon symbol code is placed
  1113. X! in the calendar first.  For this reason, you should not provide \fBPS\fR
  1114. X! or \fBPSFILE\fR-type reminders with priorities; instead, you should
  1115. X! ensure that they appear in the reminder script in the correct order.
  1116. X! PostScript code should draw objects working from the background to the
  1117. X! foreground, so that foreground objects properly overlay background ones.
  1118. X! If you prioritize these reminders and run the script using descending
  1119. X! sort order for priorities, the PostScript output will not work.
  1120. X! .PP
  1121. X! All of the PostScript code for a particular date is enclosed
  1122. X  in a \fBsave\fR-\fBrestore\fR pair.  However, if several PostScript-type
  1123. X  reminders are triggered for a single day, each section of PostScript is
  1124. X  not enclosed in a \fBsave\fR-\fBrestore\fR pair - instead, the entire
  1125. X***************
  1126. X*** 2855,2875 ****
  1127. X  .SH SORTING REMINDERS
  1128. X  .PP
  1129. X  The \fB\-g\fR option causes \fBRemind\fR to sort reminders by
  1130. X! trigger date and time before issuing them.  Note that reminders are
  1131. X  still calculated in the order encountered in the script.  However, rather
  1132. X  than being issued immediately, they are saved in an internal buffer.
  1133. X  When \fBRemind\fR has finished processing the script, it issues the
  1134. X  saved reminders in sorted order.  The \fB\-g\fR option can be followed
  1135. X! by one or two characters, which must be "a" or "d".  The first character
  1136. X! specifies the sort order by trigger date (ascending or descending) and
  1137. X! the second specifies the sort order by trigger time.  The default is
  1138. X! to sort both fields in ascending order.
  1139. X  .PP
  1140. X  In ascending order, reminders are issued with the most imminent first.
  1141. X  Descending order is the reverse.  Reminders are always sorted by
  1142. X  trigger date, and reminders with the same trigger date are then sorted
  1143. X  by trigger time.  Non-timed reminders are always issued after timed
  1144. X! reminders in this mode.
  1145. X  .PP
  1146. X  You can define a user-defined function called SORTBANNER which takes one
  1147. X  \fBDATE\fR-type argument.  In sort mode, the following sequence happens:
  1148. X--- 2987,3010 ----
  1149. X  .SH SORTING REMINDERS
  1150. X  .PP
  1151. X  The \fB\-g\fR option causes \fBRemind\fR to sort reminders by
  1152. X! trigger date, time and priority before issuing them.  Note that reminders are
  1153. X  still calculated in the order encountered in the script.  However, rather
  1154. X  than being issued immediately, they are saved in an internal buffer.
  1155. X  When \fBRemind\fR has finished processing the script, it issues the
  1156. X  saved reminders in sorted order.  The \fB\-g\fR option can be followed
  1157. X! by up to three characters, which must be "a" or "d".  The first character
  1158. X! specifies the sort order by trigger date (ascending or descending),
  1159. X! the second specifies the sort order by trigger time and the third
  1160. X! specifies the sort order by priority.  The default is
  1161. X! to sort all fields in ascending order.
  1162. X  .PP
  1163. X  In ascending order, reminders are issued with the most imminent first.
  1164. X  Descending order is the reverse.  Reminders are always sorted by
  1165. X  trigger date, and reminders with the same trigger date are then sorted
  1166. X  by trigger time.  Non-timed reminders are always issued after timed
  1167. X! reminders in this mode.  If two reminders have the same date and time,
  1168. X! then the priority is used to break ties.  Reminders with the same date,
  1169. X! time and priority are issued in the order they were encountered.
  1170. X  .PP
  1171. X  You can define a user-defined function called SORTBANNER which takes one
  1172. X  \fBDATE\fR-type argument.  In sort mode, the following sequence happens:
  1173. X***************
  1174. X*** 2926,2931 ****
  1175. X--- 3061,3121 ----
  1176. X      endif
  1177. X  .fi
  1178. X  .PP
  1179. X+ .SH MSGPREFIX() AND MSGSUFFIX()
  1180. X+ .PP
  1181. X+ You can define two functions in your script called \fBmsgprefix()\fR
  1182. X+ and \fBmsgsuffix()\fR.  They should each accept one argument, a number
  1183. X+ from 0 to 9999.
  1184. X+ .PP
  1185. X+ In normal mode, for \fBMSG\fR- and \fBMSF\fR-type reminders,
  1186. X+ the following sequence occurs when
  1187. X+ \fBRemind\fR triggers a reminder:
  1188. X+ .TP
  1189. X+ o
  1190. X+ If \fBmsgprefix()\fR is defined, it is evaluated with the priority
  1191. X+ of the reminder as its argument.  The result is printed.  It is
  1192. X+ \fInot\fR passed through the substitution filter.
  1193. X+ .TP
  1194. X+ o
  1195. X+ The body of the reminder is printed.
  1196. X+ .TP
  1197. X+ o
  1198. X+ If \fBmsgsuffix()\fR is defined, it is evaluated with the priority
  1199. X+ of the reminder as its argument.  The result is printed.  It is
  1200. X+ \fInot\fR passed through the substitution filter.
  1201. X+ .PP
  1202. X+ Here's an example:  The following definition causes priority-0
  1203. X+ reminders to be preceded by "URGENT", and priority-6000 reminders to
  1204. X+ be preceded by "(not important)".
  1205. X+ .PP
  1206. X+ .nf
  1207. X+     fset msgprefix(x) iif(x==0, "URGENT: ", \\
  1208. X+          x==6000, "(not important) ", "")
  1209. X+ .fi
  1210. X+ .PP
  1211. X+ In Calendar Mode (with the \fB\-c\fR, \fB\-s\fR or \fB\-p\fR options),
  1212. X+ an analagous pair of functions named \fBcalprefix()\fR and
  1213. X+ \fBcalsuffix()\fR can be defined.  They work with all reminders which
  1214. X+ produce an entry in the calendar (i.e., \fBCAL\fR- and possibly
  1215. X+ \fBRUN\fR-type reminders as well as \fBMSG\fR-type reminders.)
  1216. X+ .PP
  1217. X+ .B NOTES
  1218. X+ .PP
  1219. X+ Normally, the body of a reminder is followed by a carriage return.
  1220. X+ Thus, the results of \fBmsgsuffix()\fR will appear on the next
  1221. X+ line.  If you don't want this, end the body of the reminder with a
  1222. X+ percentage sign, "%".  If you want a space between your reminders,
  1223. X+ simply include a carriage return (\fBchar(13)\fR) as part of the
  1224. X+ \fBmsgsuffix()\fR return value.
  1225. X+ .PP
  1226. X+ If \fBRemind\fR has problems evaluating \fBmsgprefix()\fR,
  1227. X+ \fBmsgsuffix()\fR or \fBsortbanner()\fR, you will see a lot of
  1228. X+ error messages.  For an example of this, define the following:
  1229. X+ .PP
  1230. X+ .nf
  1231. X+     fset msgprefix(x) x/0
  1232. X+ .fi
  1233. X+ .PP
  1234. X  .SH FOREIGN LANGUAGE SUPPORT
  1235. X  .PP
  1236. X  Your version of \fBRemind\fR may have been compiled to support a
  1237. X***************
  1238. X*** 2992,2998 ****
  1239. X  .TP
  1240. X  .B hebdate(i_day, s_hebmon [,id_yrstart [,i_jahr [,i_aflag]]])
  1241. X  The \fBhebdate()\fR function is the most complex of the Hebrew support
  1242. X! functions.  It can take from 2 to 4 arguments.  It returns a \fBDATE\fR
  1243. X  corresponding to the Hebrew date.
  1244. X  .PP
  1245. X  .RS
  1246. X--- 3182,3188 ----
  1247. X  .TP
  1248. X  .B hebdate(i_day, s_hebmon [,id_yrstart [,i_jahr [,i_aflag]]])
  1249. X  The \fBhebdate()\fR function is the most complex of the Hebrew support
  1250. X! functions.  It can take from 2 to 5 arguments.  It returns a \fBDATE\fR
  1251. X  corresponding to the Hebrew date.
  1252. X  .PP
  1253. X  .RS
  1254. X***************
  1255. X*** 3307,3316 ****
  1256. X  versions of \fBRemind\fR prior to 03.00.01.
  1257. X  .SH AUTHOR
  1258. X  .PP
  1259. X! David F. Skoll wrote \fBRemind\fR.  The moon code was copied largely verbatim
  1260. X! from "moontool" by John Walker.  The Hebrew calendar support was taken
  1261. X! from "hdate" by Amos Shapir.  The authors of the language files are
  1262. X! listed in the header file "lang.h" which comes with \fBRemind\fR.
  1263. X  .SH BUGS
  1264. X  .PP
  1265. X  There's no good reason why read-only system variables are not
  1266. X--- 3497,3508 ----
  1267. X  versions of \fBRemind\fR prior to 03.00.01.
  1268. X  .SH AUTHOR
  1269. X  .PP
  1270. X! David F. Skoll wrote \fBRemind\fR.  The moon code was copied largely
  1271. X! unmodified from "moontool" by John Walker.  The Hebrew calendar
  1272. X! support was taken from "hdate" by Amos Shapir.  The authors of the
  1273. X! language files are listed in the header file "lang.h" which comes with
  1274. X! \fBRemind\fR.  OS/2 support was provided initially by Darrel
  1275. X! Hankerson; more complete OS/2 support was done by Russ Herman.
  1276. X  .SH BUGS
  1277. X  .PP
  1278. X  There's no good reason why read-only system variables are not
  1279. X***************
  1280. X*** 3321,3327 ****
  1281. X  .PP
  1282. X  The UTC functions are not reliable under MS-DOS.
  1283. X  .PP
  1284. X! The MS-DOS and OS/2 versions of \fBRemind\fR do not support queuing or timed
  1285. X  activation of reminders.
  1286. X  .PP
  1287. X  \fBRemind\fR has some built-in limits on total line length,
  1288. X--- 3513,3519 ----
  1289. X  .PP
  1290. X  The UTC functions are not reliable under MS-DOS.
  1291. X  .PP
  1292. X! The MS-DOS version of \fBRemind\fR does not support queuing or timed
  1293. X  activation of reminders.
  1294. X  .PP
  1295. X  \fBRemind\fR has some built-in limits on total line length,
  1296. X*** ../prev/sort.c    Tue Aug 31 16:28:20 1993
  1297. X--- ./sort.c    Tue Oct 19 11:19:14 1993
  1298. X***************
  1299. X*** 33,44 ****
  1300. X     int trigdate;
  1301. X     int trigtime;
  1302. X     int typ;
  1303. X  } Sortrem;
  1304. X  
  1305. X  /* The sorted reminder queue */
  1306. X  static Sortrem *SortedQueue = (Sortrem *) NULL;
  1307. X  
  1308. X! PRIVATE Sortrem *MakeSortRem ARGS ((int jul, int tim, char *body, int typ));
  1309. X  PRIVATE void IssueSortBanner ARGS ((int jul));
  1310. X  
  1311. X  /***************************************************************/
  1312. X--- 33,45 ----
  1313. X     int trigdate;
  1314. X     int trigtime;
  1315. X     int typ;
  1316. X+    int priority;
  1317. X  } Sortrem;
  1318. X  
  1319. X  /* The sorted reminder queue */
  1320. X  static Sortrem *SortedQueue = (Sortrem *) NULL;
  1321. X  
  1322. X! PRIVATE Sortrem *MakeSortRem ARGS ((int jul, int tim, char *body, int typ, int prio));
  1323. X  PRIVATE void IssueSortBanner ARGS ((int jul));
  1324. X  
  1325. X  /***************************************************************/
  1326. X***************
  1327. X*** 49,60 ****
  1328. X  /*                                                             */
  1329. X  /***************************************************************/
  1330. X  #ifdef HAVE_PROTOS
  1331. X! PRIVATE Sortrem *MakeSortRem(int jul, int tim, char *body, int typ)
  1332. X  #else
  1333. X! static Sortrem *MakeSortRem(jul, tim, body, typ)
  1334. X  int jul, tim;
  1335. X  char *body;
  1336. X! int typ;
  1337. X  #endif
  1338. X  {
  1339. X     Sortrem *new = NEW(Sortrem);
  1340. X--- 50,61 ----
  1341. X  /*                                                             */
  1342. X  /***************************************************************/
  1343. X  #ifdef HAVE_PROTOS
  1344. X! PRIVATE Sortrem *MakeSortRem(int jul, int tim, char *body, int typ, int prio)
  1345. X  #else
  1346. X! static Sortrem *MakeSortRem(jul, tim, body, typ, prio)
  1347. X  int jul, tim;
  1348. X  char *body;
  1349. X! int typ, prio;
  1350. X  #endif
  1351. X  {
  1352. X     Sortrem *new = NEW(Sortrem);
  1353. X***************
  1354. X*** 69,74 ****
  1355. X--- 70,76 ----
  1356. X     new->trigdate = jul;
  1357. X     new->trigtime = tim;
  1358. X     new->typ = typ;
  1359. X+    new->priority = prio;
  1360. X     new->next = NULL;
  1361. X     return new;
  1362. X  }
  1363. X***************
  1364. X*** 81,96 ****
  1365. X  /*                                                             */
  1366. X  /***************************************************************/
  1367. X  #ifdef HAVE_PROTOS
  1368. X! PUBLIC int InsertIntoSortBuffer(int jul, int tim, char *body, int typ)
  1369. X  #else
  1370. X! int InsertIntoSortBuffer(jul, tim, body, typ)
  1371. X  int jul;
  1372. X  int tim;
  1373. X  char *body;
  1374. X! int typ;
  1375. X  #endif
  1376. X  {
  1377. X!    Sortrem *new = MakeSortRem(jul, tim, body, typ);
  1378. X     Sortrem *cur = SortedQueue, *prev = NULL;
  1379. X     int ShouldGoAfter;
  1380. X  
  1381. X--- 83,98 ----
  1382. X  /*                                                             */
  1383. X  /***************************************************************/
  1384. X  #ifdef HAVE_PROTOS
  1385. X! PUBLIC int InsertIntoSortBuffer(int jul, int tim, char *body, int typ, int prio)
  1386. X  #else
  1387. X! int InsertIntoSortBuffer(jul, tim, body, typ, prio)
  1388. X  int jul;
  1389. X  int tim;
  1390. X  char *body;
  1391. X! int typ, prio;
  1392. X  #endif
  1393. X  {
  1394. X!    Sortrem *new = MakeSortRem(jul, tim, body, typ, prio);
  1395. X     Sortrem *cur = SortedQueue, *prev = NULL;
  1396. X     int ShouldGoAfter;
  1397. X  
  1398. X***************
  1399. X*** 99,104 ****
  1400. X--- 101,107 ----
  1401. X        IssueSortedReminders();
  1402. X        SortByDate = 0;
  1403. X        SortByTime = 0;
  1404. X+       SortByPrio = 0;
  1405. X        return E_NO_MEM;
  1406. X     }
  1407. X  
  1408. X***************
  1409. X*** 108,126 ****
  1410. X        return OK;
  1411. X     }
  1412. X     while (cur) {
  1413. X!       if (cur->trigdate == new->trigdate) {
  1414. X!          ShouldGoAfter =
  1415. X!         (SortByTime == SORT_ASCEND) ?
  1416. X!            (new->trigtime >= cur->trigtime) :
  1417. X!            ((new->trigtime == NO_TIME) || (new->trigtime <= cur->trigtime));
  1418. X!       } else {
  1419. X!          ShouldGoAfter =
  1420. X!         (SortByDate == SORT_ASCEND) ?
  1421. X!            (new->trigdate >= cur->trigdate) :
  1422. X!            (new->trigdate <= cur->trigdate);
  1423. X!       }
  1424. X! 
  1425. X!       if (ShouldGoAfter) {
  1426. X           prev = cur;
  1427. X       cur = cur->next;
  1428. X        } else {
  1429. X--- 111,121 ----
  1430. X        return OK;
  1431. X     }
  1432. X     while (cur) {
  1433. X!       ShouldGoAfter = CompareRems(new->trigdate, new->trigtime, new->priority,
  1434. X!               cur->trigdate, cur->trigtime, cur->priority,
  1435. X!               SortByDate, SortByTime, SortByPrio);
  1436. X!               
  1437. X!       if (ShouldGoAfter <= 0) {
  1438. X           prev = cur;
  1439. X       cur = cur->next;
  1440. X        } else {
  1441. X***************
  1442. X*** 160,183 ****
  1443. X  
  1444. X     while (cur) {
  1445. X        next = cur->next;
  1446. X!       if (cur->typ == MSG_TYPE || cur->typ == MSF_TYPE) {
  1447. X!     if (!MsgCommand) {
  1448. X!             if (cur->trigdate != olddate) {
  1449. X!                IssueSortBanner(cur->trigdate);
  1450. X!            olddate = cur->trigdate;
  1451. X              }
  1452. X!         if (cur->typ == MSG_TYPE)
  1453. X!                printf("%s\n", cur->text);
  1454. X!             else
  1455. X!            FillParagraph(cur->text);
  1456. X!          } else {
  1457. X!             char buf[LINELEN+TOKSIZE];
  1458. X!             sprintf(buf, MsgCommand, cur->text);
  1459. X!         system(buf);
  1460. X!          }
  1461. X!       } else { /* Must be RUN_TYPE */
  1462. X!          system(cur->text);
  1463. X        }
  1464. X        free(cur->text);
  1465. X        free(cur);
  1466. X        cur = next;
  1467. X--- 155,194 ----
  1468. X  
  1469. X     while (cur) {
  1470. X        next = cur->next;
  1471. X!       switch(cur->typ) {
  1472. X!          case MSG_TYPE:
  1473. X!         if (MsgCommand) {
  1474. X!            char buf[LINELEN+TOKSIZE];
  1475. X!            sprintf(buf, MsgCommand, cur->text);
  1476. X!            system(buf);
  1477. X!             } else {
  1478. X!            if (cur->trigdate != olddate) {
  1479. X!               IssueSortBanner(cur->trigdate);
  1480. X!           olddate = cur->trigdate;
  1481. X!                }
  1482. X! #ifdef __OS2__
  1483. X!                PutlPopUp(cur->text);
  1484. X! #else
  1485. X!                printf("%s", cur->text);
  1486. X! #endif
  1487. X              }
  1488. X!         break;
  1489. X! 
  1490. X!      case MSF_TYPE:
  1491. X! #ifdef __OS2__
  1492. X!             StartPopUp();
  1493. X! #endif
  1494. X!         FillParagraph(cur->text);
  1495. X! #ifdef __OS2__
  1496. X!             EndPopUp();
  1497. X! #endif
  1498. X!         break;
  1499. X! 
  1500. X!      case RUN_TYPE:
  1501. X!         system(cur->text);
  1502. X!         break;
  1503. X        }
  1504. X+ 
  1505. X        free(cur->text);
  1506. X        free(cur);
  1507. X        cur = next;
  1508. X***************
  1509. X*** 214,217 ****
  1510. X--- 225,267 ----
  1511. X     if (!DoSubstFromString(v.v.str, SubstBuffer, jul, NO_TIME))
  1512. X        if (*SubstBuffer) printf("%s\n", SubstBuffer);
  1513. X     DestroyValue(&v);
  1514. X+ }
  1515. X+ 
  1516. X+ /***************************************************************/
  1517. X+ /*                                                             */
  1518. X+ /*  CompareRems                                                */
  1519. X+ /*                                                             */
  1520. X+ /*  Compare two reminders for sorting.  Return 0 if they       */
  1521. X+ /*  compare equal; 1 if rem2 should come after rem1, -1 if     */
  1522. X+ /*  rem1 should come after rem2.  bydate and bytime control    */
  1523. X+ /*  sorting direction by date and time, resp.                  */
  1524. X+ /*                                                             */
  1525. X+ /***************************************************************/
  1526. X+ #ifdef HAVE_PROTOS
  1527. X+ PUBLIC int CompareRems(int dat1, int tim1, int prio1,
  1528. X+                        int dat2, int tim2, int prio2,
  1529. X+                int bydate, int bytime, int byprio)
  1530. X+ #else
  1531. X+ int CompareRems(dat1, tim1, prio1, dat2, tim2, prio2, bydate, bytime, byprio)
  1532. X+ int dat1, tim1, prio1, dat2, tim2, prio2, bydate, bytime, byprio;
  1533. X+ #endif
  1534. X+ {
  1535. X+    int dafter, tafter, pafter;
  1536. X+ 
  1537. X+    dafter = (bydate != SORT_DESCEND) ? 1 : -1;
  1538. X+    tafter = (bytime != SORT_DESCEND) ? 1 : -1;
  1539. X+    pafter = (byprio != SORT_DESCEND) ? 1 : -1;
  1540. X+ 
  1541. X+    if (dat1 < dat2) return dafter;
  1542. X+    if (dat1 > dat2) return -dafter;
  1543. X+ 
  1544. X+    if (tim1 == NO_TIME && tim2 != NO_TIME) return -1;
  1545. X+    if (tim1 != NO_TIME && tim2 == NO_TIME) return 1;
  1546. X+    if (tim1 < tim2) return tafter;
  1547. X+    if (tim1 > tim2) return -tafter;
  1548. X+ 
  1549. X+    if (prio1 < prio2) return pafter;
  1550. X+    if (prio1 > prio2) return -pafter;
  1551. X+ 
  1552. X+    return 0;
  1553. X  }
  1554. X*** ../prev/test.cmp    Tue Aug 31 13:22:46 1993
  1555. X--- ./test.cmp    Tue Oct 12 16:22:53 1993
  1556. X***************
  1557. X*** 631,637 ****
  1558. X  "a05" + "6" => "a056"
  1559. X  value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
  1560. X  set a058 version()
  1561. X! version() => "03.00.09"
  1562. X  set a059 wkday(today())
  1563. X  today() => 1991/02/16
  1564. X  wkday(1991/02/16) => "Saturday"
  1565. X--- 631,637 ----
  1566. X  "a05" + "6" => "a056"
  1567. X  value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
  1568. X  set a058 version()
  1569. X! version() => "03.00.10"
  1570. X  set a059 wkday(today())
  1571. X  today() => 1991/02/16
  1572. X  wkday(1991/02/16) => "Saturday"
  1573. X***************
  1574. X*** 772,778 ****
  1575. X          a048  "foo"
  1576. X          a067  "INT"
  1577. X          a039  "February"
  1578. X!         a058  "03.00.09"
  1579. X          a077  "1992 92
  1580. X  "
  1581. X          a049  21
  1582. X--- 772,778 ----
  1583. X          a048  "foo"
  1584. X          a067  "INT"
  1585. X          a039  "February"
  1586. X!         a058  "03.00.10"
  1587. X          a077  "1992 92
  1588. X  "
  1589. X          a049  21
  1590. X*** ../prev/token.c    Fri Sep  3 11:50:53 1993
  1591. X--- ./token.c    Wed Oct 20 11:45:09 1993
  1592. X***************
  1593. X*** 11,16 ****
  1594. X--- 11,17 ----
  1595. X  /***************************************************************/
  1596. X  #include "config.h"
  1597. X  #include <stdio.h>
  1598. X+ #include <string.h>
  1599. X  #include <ctype.h>
  1600. X  #ifdef HAVE_STDLIB_H
  1601. X  #include <stdlib.h>
  1602. X***************
  1603. X*** 77,82 ****
  1604. X--- 78,84 ----
  1605. X     { "once",         3,     T_Once,        0 },
  1606. X     { "pop-omit-context", 3,    T_Pop,        0 },
  1607. X     { "preserve",        8,      T_Preserve,     0 },
  1608. X+    { "priority",    8,    T_Priority,    0 },
  1609. X     { "ps",         2,     T_RemType,     PS_TYPE },
  1610. X     { "psfile",         6,     T_RemType,     PSF_TYPE },
  1611. X     { "push-omit-context", 4,     T_Push,        0 },
  1612. X***************
  1613. X*** 85,90 ****
  1614. X--- 87,93 ----
  1615. X     { "satisfy",        7,    T_RemType,      SAT_TYPE },
  1616. X     { "saturday",    3,    T_WkDay,    5 },
  1617. X     { "scanfrom",    4,    T_Scanfrom,    0 },
  1618. X+    { "sched",        5,    T_Sched,    0 },
  1619. X     { "september",     3,     T_Month,     8 },
  1620. X     { "set",        3,    T_Set,        0 },
  1621. X     { "skip",         3,     T_Skip,     SKIP_SKIP },
  1622. X*** ../prev/types.h    Fri Sep  3 11:50:48 1993
  1623. X--- ./types.h    Wed Oct 20 11:50:55 1993
  1624. X***************
  1625. X*** 52,57 ****
  1626. X--- 52,59 ----
  1627. X     int typ;
  1628. X     int once;
  1629. X     int scanfrom;
  1630. X+    int priority;
  1631. X+    char sched[VAR_NAME_LEN+1];  /* Scheduling function */
  1632. X  } Trigger;
  1633. X  
  1634. X  /* A time trigger */
  1635. X***************
  1636. X*** 93,98 ****
  1637. X--- 95,102 ----
  1638. X  
  1639. X  #define NO_TIME 1500 /* >1440, ie > than the largest possible legal time */
  1640. X  
  1641. X+ #define NO_PRIORITY 5000 /* Default priority is midway between 0 and 9999 */
  1642. X+ 
  1643. X  #define NO_TYPE  0
  1644. X  #define MSG_TYPE 1
  1645. X  #define RUN_TYPE 2
  1646. X***************
  1647. X*** 127,133 ****
  1648. X    T_Debug,
  1649. X    T_Dumpvars,
  1650. X    T_Scanfrom,
  1651. X!   T_Flush
  1652. X  };
  1653. X  
  1654. X  /* The structure of a token */
  1655. X--- 131,139 ----
  1656. X    T_Debug,
  1657. X    T_Dumpvars,
  1658. X    T_Scanfrom,
  1659. X!   T_Flush,
  1660. X!   T_Priority,
  1661. X!   T_Sched
  1662. X  };
  1663. X  
  1664. X  /* The structure of a token */
  1665. X***************
  1666. X*** 162,166 ****
  1667. X  #define SC_NOTIME 2   /* Do not display time in SC format. */
  1668. X  
  1669. X  /* Flags for sorting */
  1670. X! #define SORT_ASCEND 1
  1671. X  #define SORT_DESCEND 2
  1672. X--- 168,173 ----
  1673. X  #define SC_NOTIME 2   /* Do not display time in SC format. */
  1674. X  
  1675. X  /* Flags for sorting */
  1676. X! #define SORT_NONE    0
  1677. X! #define SORT_ASCEND  1
  1678. X  #define SORT_DESCEND 2
  1679. X*** ../prev/var.c    Tue Sep 28 16:16:07 1993
  1680. X--- ./var.c    Thu Oct 14 10:21:45 1993
  1681. X***************
  1682. X*** 474,479 ****
  1683. X--- 474,482 ----
  1684. X     {   "PSCal",          0,    INT_TYPE,    &PsCal,        0,    0   },
  1685. X     {   "RunOff",      0,    INT_TYPE,    &RunDisabled,    0,    0   },
  1686. X     {   "SimpleCal",      0,    INT_TYPE,    &DoSimpleCalendar,    0,  0 },
  1687. X+    {   "SortByDate",      0,    INT_TYPE,    &SortByDate,    0,    0},
  1688. X+    {   "SortByPrio",      0,    INT_TYPE,    &SortByPrio,    0,    0},
  1689. X+    {   "SortByTime",      0,    INT_TYPE,    &SortByTime,    0,    0},
  1690. X     {   "SubsIndent",      1,    INT_TYPE,    &SubsIndent,    0,    132}
  1691. X  };
  1692. X  
  1693. END_OF_FILE
  1694.   if test 50141 -ne `wc -c <'patch.10.C'`; then
  1695.     echo shar: \"'patch.10.C'\" unpacked with wrong size!
  1696.   elif test -f 'patch.10.A' && test -f 'patch.10.B'; then 
  1697.     echo shar: Combining  \"'patch.10'\" \(95017 characters\) 
  1698.     cat 'patch.10.A' 'patch.10.B' 'patch.10.C' > 'patch.10' 
  1699.     if test 95017 -ne `wc -c <'patch.10'`; then 
  1700.       echo shar: \"'patch.10'\" combined with wrong size! 
  1701.     else 
  1702.       rm patch.10.A patch.10.B patch.10.C 
  1703.     fi 
  1704.   fi
  1705.   # end of 'patch.10.C'
  1706. fi
  1707. if test -f 'test-rem.bat' -a "${1}" != "-c" ; then 
  1708.   echo shar: Will not clobber existing file \"'test-rem.bat'\"
  1709. else
  1710.   echo shar: Extracting \"'test-rem.bat'\" \(763 characters\)
  1711.   sed "s/^X//" >'test-rem.bat' <<'END_OF_FILE'
  1712. X@echo off
  1713. Xrem ---------------------------------------------------------------------------
  1714. Xrem TEST-REM
  1715. Xrem
  1716. Xrem This file runs an MSDOS acceptance test for Remind.  To use it, type:
  1717. Xrem     test-rem
  1718. Xrem in the build directory.
  1719. Xrem
  1720. Xrem This file is part of REMIND.
  1721. Xrem Copyright (C) 1992, 1993 by David F. Skoll
  1722. Xrem ---------------------------------------------------------------------------
  1723. X
  1724. Xdel test.out > nul
  1725. Xset TEST_GETENV=foo bar baz
  1726. X..\msdos-ex\remind -e -dxte .\test.rem 16 feb 1991 > test.out
  1727. Xecho n | comp test.out test1.cmp
  1728. Xif errorlevel 1 goto oops
  1729. Xecho "Remind:  Acceptance test PASSED"
  1730. Xgoto quit
  1731. X:oops
  1732. Xecho "Remind:  Acceptance test FAILED"
  1733. Xecho ""
  1734. Xecho "Examine the file test.out to see where it differs from the"
  1735. Xecho "reference file test1.cmp."
  1736. X:quit
  1737. END_OF_FILE
  1738.   if test 763 -ne `wc -c <'test-rem.bat'`; then
  1739.     echo shar: \"'test-rem.bat'\" unpacked with wrong size!
  1740.   fi
  1741.   # end of 'test-rem.bat'
  1742. fi
  1743. if test -f 'test-rem.cmd' -a "${1}" != "-c" ; then 
  1744.   echo shar: Will not clobber existing file \"'test-rem.cmd'\"
  1745. else
  1746.   echo shar: Extracting \"'test-rem.cmd'\" \(782 characters\)
  1747.   sed "s/^X//" >'test-rem.cmd' <<'END_OF_FILE'
  1748. X@echo off
  1749. Xrem ---------------------------------------------------------------------------
  1750. Xrem TEST-REM
  1751. Xrem
  1752. Xrem This file runs an OS/2 acceptance test for Remind.    To use it, type:
  1753. Xrem     test-rem
  1754. Xrem in the build directory.
  1755. Xrem
  1756. Xrem This file is part of REMIND.
  1757. Xrem Copyright (C) 1992, 1993 by David F. Skoll
  1758. Xrem ---------------------------------------------------------------------------
  1759. X
  1760. Xdel /f test.out > nul
  1761. Xsetlocal
  1762. Xset TEST_GETENV=foo bar baz
  1763. X..\os2-ex\remind -e -dxte .\test.rem 16 feb 1991 > .\test.out
  1764. Xecho n | comp test.out test2.cmp
  1765. Xif errorlevel 1 goto oops
  1766. Xecho "Remind:  Acceptance test PASSED"
  1767. Xgoto quit
  1768. X:oops
  1769. Xecho "Remind:  Acceptance test FAILED"
  1770. Xecho ""
  1771. Xecho "Examine the file test.out to see where it differs from the"
  1772. Xecho "reference file test2.cmp."
  1773. X:quit
  1774. Xendlocal
  1775. END_OF_FILE
  1776.   if test 782 -ne `wc -c <'test-rem.cmd'`; then
  1777.     echo shar: \"'test-rem.cmd'\" unpacked with wrong size!
  1778.   fi
  1779.   # end of 'test-rem.cmd'
  1780. fi
  1781. echo shar: End of archive 2 \(of 3\).
  1782. cp /dev/null ark2isdone
  1783. MISSING=""
  1784. for I in 1 2 3 ; do
  1785.     if test ! -f ark${I}isdone ; then
  1786.     MISSING="${MISSING} ${I}"
  1787.     fi
  1788. done
  1789. if test "${MISSING}" = "" ; then
  1790.     echo You have unpacked all 3 archives.
  1791.     rm -f ark[1-9]isdone
  1792. else
  1793.     echo You still must unpack the following archives:
  1794.     echo "        " ${MISSING}
  1795. fi
  1796. exit 0
  1797. exit 0 # Just in case...
  1798.