home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / sun / volume2 / calentool / patch5b / patches05b < prev   
Encoding:
Text File  |  1990-02-04  |  45.8 KB  |  1,820 lines

  1. *** /tmp/,RCSt1a16916    Fri Dec 15 17:22:32 1989
  2. --- ct.h    Fri Dec 15 17:17:07 1989
  3. ***************
  4. *** 1,5
  5.   /*
  6. !  * $Header: ct.h,v 2.2 89/07/19 20:26:27 billr Exp $
  7.    */
  8.   /*
  9.    * ct.h - header file for calentool
  10.  
  11. --- 1,5 -----
  12.   /*
  13. !  * $Header: ct.h,v 2.3 89/12/15 17:17:04 billr Exp $
  14.    */
  15.   /*
  16.    * ct.h - header file for calentool
  17. ***************
  18. *** 22,27
  19.    * notice remains intact.
  20.    */
  21.   
  22.   /* directory for date/event files */
  23.   #ifndef DATELIB_DIR
  24.   #    define DATELIB_DIR    "/usr/net/lib/calentool"
  25.  
  26. --- 22,35 -----
  27.    * notice remains intact.
  28.    */
  29.   
  30. + /* ignore several things for calencheck program */
  31. + #ifdef CALENCHECK
  32. + #    define NO_PRINTER
  33. + #    define NO_HOLIDAYS
  34. + #    define NO_SUN_MOON
  35. + #    define NOTOOL
  36. + #endif
  37.   /* directory for date/event files */
  38.   #ifndef DATELIB_DIR
  39.   #    define DATELIB_DIR    "/usr/net/lib/calentool"
  40. ***************
  41. *** 27,33
  42.   #    define DATELIB_DIR    "/usr/net/lib/calentool"
  43.   #endif
  44.   
  45. ! #ifndef NOPRINTER
  46.   /* command string for sending a file to the Postscript printer */
  47.   #    ifndef PRINT_CMD
  48.   #        define PRINT_CMD    "lpr -Plw"
  49.  
  50. --- 35,41 -----
  51.   #    define DATELIB_DIR    "/usr/net/lib/calentool"
  52.   #endif
  53.   
  54. ! #ifndef NO_PRINTER
  55.   /* command string for sending a file to the Postscript printer */
  56.   #    ifndef PRINT_CMD
  57.   #        define PRINT_CMD    "lpr -Plw"
  58. ***************
  59. *** 39,44
  60.   #endif
  61.   #endif
  62.   
  63.   /* define NR_WEEKDAYS for desired week display */
  64.   /* NR_WEEKDAYS        display   */
  65.   /*    5        Mon-Fri   */
  66.  
  67. --- 47,57 -----
  68.   #endif
  69.   #endif
  70.   
  71. + #ifndef MAILPROG
  72. + #    define MAILPROG        "/usr/ucb/mail"
  73. +                 /* assumes -s option is available */
  74. + #endif
  75.   /* define NR_WEEKDAYS for desired week display */
  76.   /* NR_WEEKDAYS        display   */
  77.   /*    5        Mon-Fri   */
  78. ***************
  79. *** 43,49
  80.   /* NR_WEEKDAYS        display   */
  81.   /*    5        Mon-Fri   */
  82.   /*    6        Mon-Sat      */
  83. ! /*    7        Sun-Sat      */
  84.   /**/
  85.   #ifndef NR_WEEKDAYS
  86.   #    define NR_WEEKDAYS    5
  87.  
  88. --- 56,62 -----
  89.   /* NR_WEEKDAYS        display   */
  90.   /*    5        Mon-Fri   */
  91.   /*    6        Mon-Sat      */
  92. ! /*    7        Sun-Sat    or Mon-Sun  */
  93.   /**/
  94.   #ifndef NR_WEEKDAYS
  95.   #    define NR_WEEKDAYS    5
  96. ***************
  97. *** 48,53
  98.   #ifndef NR_WEEKDAYS
  99.   #    define NR_WEEKDAYS    5
  100.   #endif
  101.   
  102.   #ifndef START_HOUR
  103.   #    define START_HOUR    8    /* 8am */
  104.  
  105. --- 61,69 -----
  106.   #ifndef NR_WEEKDAYS
  107.   #    define NR_WEEKDAYS    5
  108.   #endif
  109. + #ifndef MON_FIRST
  110. + #    define MON_FIRST    0    /* 0=Sun-Sat, 1=Mon-Sun */
  111. + #endif
  112.   
  113.   #ifndef START_HOUR
  114.   #    define START_HOUR    8    /* 8am */
  115. ***************
  116. *** 55,60
  117.   #ifndef END_HOUR
  118.   #    define END_HOUR        18    /* 6pm */
  119.   #endif
  120.   
  121.   #ifndef START_YEAR
  122.   #    define START_YEAR    89
  123.  
  124. --- 71,82 -----
  125.   #ifndef END_HOUR
  126.   #    define END_HOUR        18    /* 6pm */
  127.   #endif
  128. + #ifndef HOUR_24
  129. + #    define HOUR_24        0    /* 0=12hr time, 1=24hr time */
  130. + #endif
  131. + #ifndef DAY_FIRST
  132. + #    define DAY_FIRST    0    /* 0=M/D/Y, 1=D/M/Y */
  133. + #endif
  134.   
  135.   #ifndef START_YEAR
  136.   #    define START_YEAR    89
  137. ***************
  138. *** 66,72
  139.   #ifndef UPDATE_RATE
  140.   #    define UPDATE_RATE    "second"    /* update time */
  141.   #endif                     /* options are "second" & "minute" */
  142. ! #define TIME_OUT    5        /* check appts every 5 minutes */
  143.   
  144.   /*
  145.    * If calentool is too big and you want a stripped-down version
  146.  
  147. --- 88,94 -----
  148.   #ifndef UPDATE_RATE
  149.   #    define UPDATE_RATE    "second"    /* update time */
  150.   #endif                     /* options are "second" & "minute" */
  151. ! #define TIME_OUT    2        /* check appts every 5 minutes */
  152.   
  153.   /*
  154.    * APPT_CHECK_LIMIT is typically either "n_tslots"
  155. ***************
  156. *** 69,74
  157.   #define TIME_OUT    5        /* check appts every 5 minutes */
  158.   
  159.   /*
  160.    * If calentool is too big and you want a stripped-down version
  161.    * define some or all of these here or in the Makefile. Combined,
  162.    * they save ~100K bytes.
  163.  
  164. --- 91,106 -----
  165.   #define TIME_OUT    2        /* check appts every 5 minutes */
  166.   
  167.   /*
  168. +  * APPT_CHECK_LIMIT is typically either "n_tslots"
  169. +  * or "N_SLOTS" depending on whether we include the
  170. +  * notes section when indicating that we still have
  171. +  * appts today.
  172. +  */
  173. + #ifndef APPT_CHECK_LIMIT
  174. + #    define APPT_CHECK_LIMIT    n_tslots
  175. + #endif
  176. + /*
  177.    * If calentool is too big and you want a stripped-down version
  178.    * define some or all of these here or in the Makefile. Combined,
  179.    * they save ~100K bytes.
  180. ***************
  181. *** 94,109
  182.   #define N_SLOTS        (N_TSLOTS+10)    /* Total number of slots on a day page. */
  183.   #define MAX_FUTURE_ENTRIES    32    /* number of appts displayed in popup window */
  184.   
  185. - /*
  186. -  * APPT_CHECK_LIMIT is typically either "n_tslots"
  187. -  * or "N_SLOTS" depending on whether we include the
  188. -  * notes section when indicating that we still have
  189. -  * appts today.
  190. -  */
  191. - #ifndef APPT_CHECK_LIMIT
  192. - #    define APPT_CHECK_LIMIT    n_tslots
  193. - #endif
  194.   /* Dimensions of 30-minute week slot.
  195.    * Message size determines width - everything else keyed
  196.    * off font size and message size
  197.  
  198. --- 126,131 -----
  199.   #define N_SLOTS        (N_TSLOTS+10)    /* Total number of slots on a day page. */
  200.   #define MAX_FUTURE_ENTRIES    32    /* number of appts displayed in popup window */
  201.   
  202.   /* Dimensions of 30-minute week slot.
  203.    * Message size determines width - everything else keyed
  204.    * off font size and message size
  205. ***************
  206. *** 110,115
  207.    */
  208.   #define WEEK_MESSAGE_SIZE    12
  209.   
  210.   #define DISPLAYING_DAY          1       /* Defs for state of main */
  211.   #define DISPLAYING_WEEK         2    /* subwindow (mainsw_state) */
  212.   #define DISPLAYING_MONTH        3
  213.  
  214. --- 132,139 -----
  215.    */
  216.   #define WEEK_MESSAGE_SIZE    12
  217.   
  218. + #define MAX_INCLUDE_NESTING    4    /* number of allowed include files */
  219.   #define DISPLAYING_DAY          1       /* Defs for state of main */
  220.   #define DISPLAYING_WEEK         2    /* subwindow (mainsw_state) */
  221.   #define DISPLAYING_MONTH        3
  222. ***************
  223. *** 185,190
  224.   #define MARKED        0x800    /* don't show in month/year display */
  225.   #define MARKED_NOTE    0xc00
  226.   #define DELETED        0x1000    /* don't show the appt that matches this */
  227.   
  228.   /* format of repeat field for every_someday type appts */
  229.   #define WEEK1        0x1
  230.  
  231. --- 209,215 -----
  232.   #define MARKED        0x800    /* don't show in month/year display */
  233.   #define MARKED_NOTE    0xc00
  234.   #define DELETED        0x1000    /* don't show the appt that matches this */
  235. + #define RUN        0x2000
  236.   
  237.   /* format of repeat field for every_someday type appts */
  238.   #define WEEK1        0x1
  239. ***************
  240. *** 216,221
  241.   #define DST_STDOUT        1
  242.   #define DST_MAIL        2
  243.   
  244.   /* header line in appts file implies one-based entries and 99 memo flag */
  245.   #define HEADER        "# CalenTool V2 - DO NOT REMOVE THIS LINE\n"
  246.   
  247.  
  248. --- 241,253 -----
  249.   #define DST_STDOUT        1
  250.   #define DST_MAIL        2
  251.   
  252. + /* return codes from get_day_appts() */
  253. + #define NO_ENTRIES    0
  254. + #define SOME_APPTS    1
  255. + #define SOME_NOTES    2
  256. + #define SOME_MKNOTES    4
  257. + #define SOME_FUTURES    8
  258.   /* header line in appts file implies one-based entries and 99 memo flag */
  259.   #define HEADER        "# CalenTool V2 - DO NOT REMOVE THIS LINE\n"
  260.   
  261. ***************
  262. *** 224,229
  263.       /* describes an entry in the appointments file */
  264.       int year, month, day, hour, minute, arrows;
  265.       int repeat, lookahead, flags, sindex;
  266.       char str[MAX_STRLEN];
  267.       struct appt_entry *next;    /* ptr to next appt in list */
  268.   };                    /* NULL if last entry */
  269.  
  270. --- 256,262 -----
  271.       /* describes an entry in the appointments file */
  272.       int year, month, day, hour, minute, arrows;
  273.       int repeat, lookahead, flags, sindex;
  274. +     int runlength;
  275.       char str[MAX_STRLEN];
  276.       struct appt_entry *next;    /* ptr to next appt in list */
  277.   };                    /* NULL if last entry */
  278. *** /tmp/,RCSt1a16921    Fri Dec 15 17:22:36 1989
  279. --- datelib.c    Fri Dec 15 17:17:17 1989
  280. ***************
  281. *** 1,5
  282.   /*
  283. !  * $Header: datelib.c,v 2.2 89/07/19 20:34:23 billr Exp $
  284.    *
  285.    * datelib.c - Calendar (date) computation library
  286.    *
  287.  
  288. --- 1,5 -----
  289.   /*
  290. !  * $Header: datelib.c,v 2.3 89/12/15 17:17:08 billr Exp $
  291.    *
  292.    * datelib.c - Calendar (date) computation library
  293.    *
  294. ***************
  295. *** 89,94
  296.           "Sunday", "Monday", "Tuesday", "Wednesday",
  297.           "Thursday", "Friday", "Saturday"    };
  298.   static char    timebuf[16];
  299.   
  300.   /*
  301.    * date_string:
  302.  
  303. --- 89,96 -----
  304.           "Sunday", "Monday", "Tuesday", "Wednesday",
  305.           "Thursday", "Friday", "Saturday"    };
  306.   static char    timebuf[16];
  307. + static double    passoverJD, easterJD;
  308. + static int    passoverJY;
  309.   
  310.   /*
  311.    * date_string:
  312. ***************
  313. *** 254,259
  314.   }
  315.   
  316.   /*
  317.    * julian_day:
  318.    * Compute Julian day (>=1)
  319.    * given day (1-31), month (1-12), year (1901-2009)
  320.  
  321. --- 256,289 -----
  322.   }
  323.   
  324.   /*
  325. +  * nth_mday_of_month:
  326. +  * Compute nth m-day of the month (1-31)
  327. +  * given n (1-5), day of week (0-6, 0 for Sunday), month (1-12),
  328. +  * year (1583-9999)
  329. +  */
  330. + double
  331. + nth_mday_of_month(n, day_of_week, month, year)
  332. +     int    day_of_week, month, n, year;
  333. + {
  334. +     int    atmp, btmp, ctmp, dtmp, etmp, tmonth, tyear;
  335. +     if (month > 2) {
  336. +         tmonth = month + 1;
  337. +         tyear = year;
  338. +     }
  339. +     else {
  340. +         tmonth = month + 13;
  341. +         tyear = year - 1;
  342. +     }
  343. +     atmp = 2.6 * tmonth;
  344. +     btmp = 1.25 * tyear;
  345. +     ctmp = (tyear / 100) - 7;
  346. +     dtmp = 0.75 * ctmp;
  347. +     etmp = (day_of_week - atmp - btmp + dtmp) % 7;
  348. +     return (double) (etmp + (n * 7));
  349. + }
  350. + /*
  351.    * julian_day:
  352.    * Compute Julian day (>=1)
  353.    * given day (1-31), month (1-12), year (1901-2009)
  354. ***************
  355. *** 270,277
  356.       double    day;
  357.       int    month, year;
  358.   {
  359. !     int    atmp, btmp, monthp, yearp;
  360. !     double    ctmp;
  361.   
  362.       if (month > 2) {
  363.           monthp = month + 1;
  364.  
  365. --- 300,307 -----
  366.       double    day;
  367.       int    month, year;
  368.   {
  369. !     int    atmp, monthp, yearp;
  370. !     double    ctmp = 1720994.5 + day;
  371.   
  372.       if (month > 2) {
  373.           monthp = month + 1;
  374. ***************
  375. *** 282,288
  376.           yearp = year - 1;
  377.       }
  378.       if ((year > 1582) || (year == 1582 && month >= 10)
  379. !         || (year == 1582 && month ==10 && day >= 15)) {
  380.           atmp = year / 100;
  381.           btmp = 2 - atmp + (atmp / 4);
  382.       }
  383.  
  384. --- 312,318 -----
  385.           yearp = year - 1;
  386.       }
  387.       if ((year > 1582) || (year == 1582 && month >= 10)
  388. !         || (year == 1582 && month == 10 && day >= 15)) {
  389.           atmp = year / 100;
  390.           ctmp += 2 - atmp + (int)(atmp / 4);
  391.       }
  392. ***************
  393. *** 284,290
  394.       if ((year > 1582) || (year == 1582 && month >= 10)
  395.           || (year == 1582 && month ==10 && day >= 15)) {
  396.           atmp = year / 100;
  397. !         btmp = 2 - atmp + (atmp / 4);
  398.       }
  399.       else
  400.           btmp = 0;
  401.  
  402. --- 314,320 -----
  403.       if ((year > 1582) || (year == 1582 && month >= 10)
  404.           || (year == 1582 && month == 10 && day >= 15)) {
  405.           atmp = year / 100;
  406. !         ctmp += 2 - atmp + (int)(atmp / 4);
  407.       }
  408.       ctmp += (int)(365.25 * yearp) + (int)(30.6001 * monthp);
  409.       return ctmp;
  410. ***************
  411. *** 286,298
  412.           atmp = year / 100;
  413.           btmp = 2 - atmp + (atmp / 4);
  414.       }
  415. !     else
  416. !         btmp = 0;
  417. !     atmp = 365.25 * yearp;
  418. !     ctmp = atmp;
  419. !     atmp = 30.6001 * monthp;
  420. !     ctmp =  ctmp + atmp;
  421. !     return ctmp + day + 1720994.5 + btmp;
  422.   }
  423.   
  424.   #ifndef NO_HOLIDAYS
  425.  
  426. --- 316,323 -----
  427.           atmp = year / 100;
  428.           ctmp += 2 - atmp + (int)(atmp / 4);
  429.       }
  430. !     ctmp += (int)(365.25 * yearp) + (int)(30.6001 * monthp);
  431. !     return ctmp;
  432.   }
  433.   
  434.   #ifndef NO_HOLIDAYS
  435. ***************
  436. *** 297,302
  437.   
  438.   #ifndef NO_HOLIDAYS
  439.   /*
  440.    * corrected_julian_day:
  441.    * Correct Julian day (>=1) for conversion from JULIAN CALENDAR
  442.    * to GREGORIAN CALENDAR.
  443.  
  444. --- 322,341 -----
  445.   
  446.   #ifndef NO_HOLIDAYS
  447.   /*
  448. +  * datelib_int:
  449. +  * Calculate often used quantities (e.g. Easter, Passover) as an
  450. +  * optimization.
  451. +  */
  452. + datelib_init(year)
  453. +     int    year;
  454. + {
  455. +     void passover_init(), easter_init();
  456. +     easter_init(year);
  457. +     passover_init(year);
  458. + }
  459. + /*
  460.    * corrected_julian_day:
  461.    * Correct Julian day (>=1) for conversion from JULIAN CALENDAR
  462.    * to GREGORIAN CALENDAR.
  463. ***************
  464. *** 374,411
  465.   }
  466.   
  467.   /*
  468. -  * nth_mday_of_month:
  469. -  * Compute nth m-day of the month (1-31)
  470. -  * given n (1-5), day of week (0-6, 0 for Sunday), month (1-12),
  471. -  * year (1583-9999)
  472. -  */
  473. - double
  474. - nth_mday_of_month(n, day_of_week, month, year)
  475. -     int    day_of_week, month, n, year;
  476. - {
  477. -     int    atmp, btmp, ctmp, dtmp, etmp, ftmp, tmonth, tyear;
  478. -     if (month > 2) {
  479. -         tmonth = month + 1;
  480. -         tyear = year;
  481. -     }
  482. -     else {
  483. -         tmonth = month + 13;
  484. -         tyear = year - 1;
  485. -     }
  486. -     atmp = 2.6 * tmonth;
  487. -     btmp = 1.25 * tyear;
  488. -     ctmp = (tyear / 100) - 7;
  489. -     dtmp = 0.75 * ctmp;
  490. -     etmp = (day_of_week - atmp - btmp + dtmp) % 7;
  491. -     if (etmp == 0)
  492. -         ftmp = 7;
  493. -     else
  494. -         ftmp = etmp;
  495. -     return (double) (ftmp + (n * 7));
  496. - }
  497. - /*
  498.    * years_date_is_mday:
  499.    * Compute year(s) for which a given date is an m-day
  500.    * given starting year, ending year,
  501.  
  502. --- 413,418 -----
  503.   }
  504.   
  505.   /*
  506.    * years_date_is_mday:
  507.    * Compute year(s) for which a given date is an m-day
  508.    * given starting year, ending year,
  509. ***************
  510. *** 698,705
  511.    * Method valid for all dates in the Gregorian calendar
  512.    * (from 15 October 1583 on)
  513.    */
  514. ! double
  515. ! easter(year)
  516.       int    year;
  517.   {
  518.       double    day;
  519.  
  520. --- 705,712 -----
  521.    * Method valid for all dates in the Gregorian calendar
  522.    * (from 15 October 1583 on)
  523.    */
  524. ! void
  525. ! easter_init(year)
  526.       int    year;
  527.   {
  528.       double    day;
  529. ***************
  530. *** 721,727
  531.       mtmp = (atmp + (11 * htmp) + (22 * ltmp)) / 451;
  532.       month = (htmp + ltmp - (7 * mtmp) + 114) / 31;
  533.       day = ((htmp + ltmp - (7 * mtmp) + 114) % 31) + 1;
  534. !     return julian_day(day, month, year);
  535.   }
  536.   
  537.   /*
  538.  
  539. --- 728,734 -----
  540.       mtmp = (atmp + (11 * htmp) + (22 * ltmp)) / 451;
  541.       month = (htmp + ltmp - (7 * mtmp) + 114) / 31;
  542.       day = ((htmp + ltmp - (7 * mtmp) + 114) % 31) + 1;
  543. !     easterJD = julian_day(day, month, year);
  544.   }
  545.   
  546.   double
  547. ***************
  548. *** 724,729
  549.       return julian_day(day, month, year);
  550.   }
  551.   
  552.   /*
  553.    * first_sunday_advent:
  554.    * Christian holidays: compute Julian day for First Sunday in Advent
  555.  
  556. --- 731,743 -----
  557.       easterJD = julian_day(day, month, year);
  558.   }
  559.   
  560. + double
  561. + easter(year)
  562. +     int    year;
  563. + {
  564. +     return easterJD;
  565. + }
  566.   /*
  567.    * first_sunday_advent:
  568.    * Christian holidays: compute Julian day for First Sunday in Advent
  569. ***************
  570. *** 755,763
  571.       double    offset;
  572.       int    year;
  573.   {
  574. !     double    easter();
  575. !     return easter(year) + offset;
  576.   }
  577.   
  578.   /*
  579.  
  580. --- 769,775 -----
  581.       double    offset;
  582.       int    year;
  583.   {
  584. !     return easterJD + offset;
  585.   }
  586.   
  587.   /*
  588. ***************
  589. *** 1030,1038
  590.    * Floating point implementation by R.P.C. Rodgers; integer implementation
  591.    * (for faster calculation) by Amos Shapir (amos@nsc.com).
  592.    */
  593. ! double
  594. ! passover(year, jyear)
  595. !     int    *jyear, year;
  596.   {
  597.       int    etmp, p_day;
  598.       int    atmp, btmp, ctmp, day_of_week, dtmp, ftmp, gtmp;
  599.  
  600. --- 1042,1050 -----
  601.    * Floating point implementation by R.P.C. Rodgers; integer implementation
  602.    * (for faster calculation) by Amos Shapir (amos@nsc.com).
  603.    */
  604. ! void
  605. ! passover_init(year)
  606. !     int    year;
  607.   {
  608.       int    etmp, p_day;
  609.       int    atmp, btmp, ctmp, day_of_week, dtmp, ftmp, gtmp;
  610. ***************
  611. *** 1039,1045
  612.       int    p_month;
  613.   
  614.       atmp = year + 3760;
  615. !     *jyear = atmp;
  616.       btmp = (12 * atmp + 17) % 19;
  617.       ctmp = atmp % 4;
  618.       etmp = (765433 * btmp) - (1565 * atmp)
  619.  
  620. --- 1051,1057 -----
  621.       int    p_month;
  622.   
  623.       atmp = year + 3760;
  624. !     passoverJY = atmp;
  625.       btmp = (12 * atmp + 17) % 19;
  626.       ctmp = atmp % 4;
  627.       etmp = (765433 * btmp) - (1565 * atmp)
  628. ***************
  629. *** 1049,1055
  630.           /* day_of_week is not to be confused with the
  631.            value returned by the day_of_week routine; here, Sunday = 1 */
  632.       day_of_week = ((3 * atmp) + (5 * ctmp) + dtmp + 5) % 7;
  633. !     if (day_of_week == 0 && btmp > 11 && etmp >= 311676)
  634.           p_day = dtmp + 1;
  635.       else if (day_of_week == 1 && btmp > 6 && etmp >= 311676)
  636.           p_day = dtmp + 2;
  637.  
  638. --- 1061,1067 -----
  639.           /* day_of_week is not to be confused with the
  640.            value returned by the day_of_week routine; here, Sunday = 1 */
  641.       day_of_week = ((3 * atmp) + (5 * ctmp) + dtmp + 5) % 7;
  642. !     if (day_of_week == 0 && btmp > 11 && etmp >= 442111)
  643.           p_day = dtmp + 1;
  644.       else if (day_of_week == 1 && btmp > 6 && etmp >= 311676)
  645.           p_day = dtmp + 2;
  646. ***************
  647. *** 1067,1073
  648.           }
  649.       else
  650.           p_month = 3;
  651. !     return julian_day(p_day, p_month, year);
  652.   }
  653.   
  654.   /*
  655.  
  656. --- 1079,1085 -----
  657.           }
  658.       else
  659.           p_month = 3;
  660. !     passoverJD = julian_day((double)p_day, p_month, year);
  661.   }
  662.   
  663.   double
  664. ***************
  665. *** 1070,1075
  666.       return julian_day(p_day, p_month, year);
  667.   }
  668.   
  669.   /*
  670.    * passover_offset:
  671.    * Jewish holidays: compute Julian day as offset from Passover
  672.  
  673. --- 1082,1095 -----
  674.       passoverJD = julian_day((double)p_day, p_month, year);
  675.   }
  676.   
  677. + double
  678. + passover(year, jyear)
  679. +     int year, *jyear;
  680. + {
  681. +     *jyear = passoverJY;
  682. +     return passoverJD;
  683. + }
  684.   /*
  685.    * passover_offset:
  686.    * Jewish holidays: compute Julian day as offset from Passover
  687. ***************
  688. *** 1080,1088
  689.       double    offset;
  690.       int    *jyear, year;
  691.   {
  692. !     double    passover();
  693. !     return passover(year, jyear) + offset;
  694.   }
  695.   
  696.   /*
  697.  
  698. --- 1100,1107 -----
  699.       double    offset;
  700.       int    *jyear, year;
  701.   {
  702. !     *jyear = passoverJY;
  703. !     return passoverJD + offset;
  704.   }
  705.   
  706.   /*
  707. ***************
  708. *** 1178,1185
  709.   chanukah(year, jyear)
  710.       int    *jyear, year;
  711.   {
  712. !     double    atmp;
  713. !     int    btmp, dummy;
  714.   
  715.       atmp = passover(year, jyear);
  716.       btmp = passover((year + 1), &dummy) - atmp;
  717.  
  718. --- 1197,1204 -----
  719.   chanukah(year, jyear)
  720.       int    *jyear, year;
  721.   {
  722. !     double    atmp, ptmp;
  723. !     int    btmp, ytmp;
  724.   
  725.       atmp = passover(year, jyear);
  726.       /* we need top compute passover for next year, so
  727. ***************
  728. *** 1182,1188
  729.       int    btmp, dummy;
  730.   
  731.       atmp = passover(year, jyear);
  732. !     btmp = passover((year + 1), &dummy) - atmp;
  733.       (*jyear)++;
  734.       if (btmp == 355 || btmp == 385)
  735.           return atmp + 247.0;
  736.  
  737. --- 1201,1215 -----
  738.       int    btmp, ytmp;
  739.   
  740.       atmp = passover(year, jyear);
  741. !     /* we need top compute passover for next year, so
  742. !      * save current info and restore when done
  743. !      */
  744. !     ptmp = passoverJD;
  745. !     ytmp = passoverJY;
  746. !     passover_init(year + 1);
  747. !     btmp = passoverJD - atmp;
  748. !     passoverJD = ptmp;
  749. !     passoverJY = ytmp;
  750.       (*jyear)++;
  751.       if (btmp == 355 || btmp == 385)
  752.           return atmp + 247.0;
  753. *** /tmp/,RCSt1a16926    Fri Dec 15 17:22:44 1989
  754. --- devent.c    Fri Dec 15 17:17:23 1989
  755. ***************
  756. *** 1,5
  757.   /*
  758. !  * $Header: devent.c,v 2.5 89/09/19 05:58:58 billr Exp $
  759.    */
  760.   /*
  761.    * devent.c
  762.  
  763. --- 1,5 -----
  764.   /*
  765. !  * $Header: devent.c,v 2.6 89/12/15 17:17:18 billr Exp $
  766.    */
  767.   /*
  768.    * devent.c
  769. ***************
  770. *** 43,48
  771.   extern Panel_item everyx_pi, repeat_pi, remind_pi;
  772.   extern Panel_item whichwk_pi, marked_pi;
  773.   extern Panel_item del_choice_pi;
  774.   extern Frame del_frame;
  775.   extern Panel del_panel;
  776.   extern Pixrect tri_right_pr, tri_up_pr;
  777.  
  778. --- 43,49 -----
  779.   extern Panel_item everyx_pi, repeat_pi, remind_pi;
  780.   extern Panel_item whichwk_pi, marked_pi;
  781.   extern Panel_item del_choice_pi;
  782. + extern Panel_item runl_pi;
  783.   extern Frame del_frame;
  784.   extern Panel del_panel;
  785.   extern Pixrect tri_right_pr, tri_up_pr;
  786. ***************
  787. *** 463,469
  788.   
  789.   /* clears a day slot */
  790.   deactivate_slot(bi, dpyflag)
  791. ! int bi;
  792.   {
  793.       slots[bi].active = INACTIVE;
  794.       if (!dpyflag)
  795.  
  796. --- 464,470 -----
  797.   
  798.   /* clears a day slot */
  799.   deactivate_slot(bi, dpyflag)
  800. ! int bi, dpyflag;
  801.   {
  802.       slots[bi].active = INACTIVE;
  803.       if (!dpyflag)
  804. ***************
  805. *** 485,491
  806.   /* returns pointer to slot containing arrow head */
  807.   int
  808.   deactivate_lower_arrows(bi, dpyflag)
  809. ! int bi;
  810.   {
  811.       while (bi < N_SLOTS-1) {
  812.           bi++;
  813.  
  814. --- 486,492 -----
  815.   /* returns pointer to slot containing arrow head */
  816.   int
  817.   deactivate_lower_arrows(bi, dpyflag)
  818. ! int bi, dpyflag;
  819.   {
  820.       while (bi < N_SLOTS-1) {
  821.           bi++;
  822. ***************
  823. *** 517,522
  824.       slots[bi].cur_appt->arrows = 0;
  825.       slots[bi].cur_appt->flags = slots[bi].cur_appt->repeat = 0;
  826.       slots[bi].cur_appt->lookahead = slots[bi].cur_appt->sindex = 0;
  827.       if (bi >= n_tslots) {
  828.           /* notes section */
  829.           slots[bi].cur_appt->hour = 99;
  830.  
  831. --- 518,524 -----
  832.       slots[bi].cur_appt->arrows = 0;
  833.       slots[bi].cur_appt->flags = slots[bi].cur_appt->repeat = 0;
  834.       slots[bi].cur_appt->lookahead = slots[bi].cur_appt->sindex = 0;
  835. +     slots[bi].cur_appt->runlength = 0;
  836.       if (bi >= n_tslots) {
  837.           /* notes section */
  838.           slots[bi].cur_appt->hour = 99;
  839. ***************
  840. *** 756,761
  841.   
  842.       panel_set_value(repeat_pi, "");    /* set default */
  843.       panel_set_value(remind_pi, "");    /* set default */
  844.       if (apt->flags & ALL_DAYS)
  845.           everyx_val |= 0x1;
  846.       if (apt->flags & ALL_MONTHS)
  847.  
  848. --- 758,764 -----
  849.   
  850.       panel_set_value(repeat_pi, "");    /* set default */
  851.       panel_set_value(remind_pi, "");    /* set default */
  852. +     panel_set_value(runl_pi, "");    /* set default */
  853.       if (apt->flags & ALL_DAYS)
  854.           everyx_val |= 0x1;
  855.       if (apt->flags & ALL_MONTHS)
  856. ***************
  857. *** 780,785
  858.       if (apt->flags & LOOKAHEAD) {
  859.           sprintf(str, "%d", apt->lookahead);
  860.           panel_set_value(remind_pi, str);
  861.       }
  862.       panel_set_value(marked_pi, (apt->flags & MARKED ? 1 : 0));
  863.       if (apt->flags & A_NOTE)
  864.  
  865. --- 783,792 -----
  866.       if (apt->flags & LOOKAHEAD) {
  867.           sprintf(str, "%d", apt->lookahead);
  868.           panel_set_value(remind_pi, str);
  869. +     }
  870. +     if (apt->flags & RUN) {
  871. +         sprintf(str, "%d", apt->runlength);
  872. +         panel_set_value(runl_pi, str);
  873.       }
  874.       panel_set_value(marked_pi, (apt->flags & MARKED ? 1 : 0));
  875.       if (apt->flags & A_NOTE)
  876. *** /tmp/,RCSt1a16931    Fri Dec 15 17:22:51 1989
  877. --- dpaint.c    Fri Dec 15 17:17:29 1989
  878. ***************
  879. *** 1,5
  880.   /*
  881. !  * $Header: dpaint.c,v 2.3 89/07/19 20:27:45 billr Exp $
  882.    */
  883.   /*
  884.    * dpaint.c
  885.  
  886. --- 1,5 -----
  887.   /*
  888. !  * $Header: dpaint.c,v 2.4 89/12/15 17:17:25 billr Exp $
  889.    */
  890.   /*
  891.    * dpaint.c
  892. ***************
  893. *** 28,35
  894.    *                           *
  895.    ***************************************************/
  896.   
  897. - #include <suntool/sunview.h>
  898. - #include <suntool/canvas.h>
  899.   #include <ctype.h>
  900.   #include <sys/time.h>
  901.   #include <stdio.h>
  902.  
  903. --- 28,33 -----
  904.    *                           *
  905.    ***************************************************/
  906.   
  907.   #include <ctype.h>
  908.   #include <sys/time.h>
  909.   #include <stdio.h>
  910. ***************
  911. *** 33,38
  912.   #include <ctype.h>
  913.   #include <sys/time.h>
  914.   #include <stdio.h>
  915.   #include "ct.h"
  916.   #include "paint.h"
  917.   #include "riseset.h"
  918.  
  919. --- 31,40 -----
  920.   #include <ctype.h>
  921.   #include <sys/time.h>
  922.   #include <stdio.h>
  923. + #ifndef NOTOOL
  924. + #include <suntool/sunview.h>
  925. + #include <suntool/canvas.h>
  926. + #endif
  927.   #include "ct.h"
  928.   #include "paint.h"
  929.   #ifndef NOTOOL
  930. ***************
  931. *** 35,40
  932.   #include <stdio.h>
  933.   #include "ct.h"
  934.   #include "paint.h"
  935.   #include "riseset.h"
  936.   #define J1970   2440587.5 /* VAX clock Epoch 1970 Jan 1 (0h UT) */
  937.   
  938.  
  939. --- 37,43 -----
  940.   #endif
  941.   #include "ct.h"
  942.   #include "paint.h"
  943. + #ifndef NOTOOL
  944.   #include "riseset.h"
  945.   #define J1970   2440587.5 /* VAX clock Epoch 1970 Jan 1 (0h UT) */
  946.   
  947. ***************
  948. *** 42,48
  949.   extern Frame mframe, sframe;
  950.   extern Canvas mcanvas, scanvas;
  951.   extern Panel_item mdate_pi, sdate_pi;
  952. ! #endif
  953.   extern Pixrect *leftarrow, *rightarrow;
  954.   extern Pixrect *arrowshaft_pr, *arrowhead_pr;
  955.   extern int day_message_size;
  956.  
  957. --- 45,51 -----
  958.   extern Frame mframe, sframe;
  959.   extern Canvas mcanvas, scanvas;
  960.   extern Panel_item mdate_pi, sdate_pi;
  961. ! #endif  /* NO_SUN_MOON */
  962.   extern Pixrect *leftarrow, *rightarrow;
  963.   extern Pixrect *arrowshaft_pr, *arrowhead_pr;
  964.   extern char riseset_buf[][64];
  965. ***************
  966. *** 45,51
  967.   #endif
  968.   extern Pixrect *leftarrow, *rightarrow;
  969.   extern Pixrect *arrowshaft_pr, *arrowhead_pr;
  970. - extern int day_message_size;
  971.   extern char riseset_buf[][64];
  972.   extern int old_slot;
  973.   extern int show_future;
  974.  
  975. --- 48,53 -----
  976.   #endif  /* NO_SUN_MOON */
  977.   extern Pixrect *leftarrow, *rightarrow;
  978.   extern Pixrect *arrowshaft_pr, *arrowhead_pr;
  979.   extern char riseset_buf[][64];
  980.   extern int old_slot;
  981.   #endif  /* NOTOOL */
  982. ***************
  983. *** 48,53
  984.   extern int day_message_size;
  985.   extern char riseset_buf[][64];
  986.   extern int old_slot;
  987.   extern int show_future;
  988.   extern char *index();
  989.   
  990.  
  991. --- 50,57 -----
  992.   extern Pixrect *arrowshaft_pr, *arrowhead_pr;
  993.   extern char riseset_buf[][64];
  994.   extern int old_slot;
  995. + #endif  /* NOTOOL */
  996. + extern int day_message_size;
  997.   extern int show_future;
  998.   extern char *index();
  999.   
  1000. ***************
  1001. *** 55,60
  1002.   struct appt_entry future[MAX_FUTURE_ENTRIES];
  1003.   int findex = 0;        /* index into struct future array */
  1004.   
  1005.   /*
  1006.    * This one draws the current selected day in the
  1007.    * main subwindow.
  1008.  
  1009. --- 59,65 -----
  1010.   struct appt_entry future[MAX_FUTURE_ENTRIES];
  1011.   int findex = 0;        /* index into struct future array */
  1012.   
  1013. + #ifndef NOTOOL
  1014.   /*
  1015.    * This one draws the current selected day in the
  1016.    * main subwindow.
  1017. ***************
  1018. *** 116,125
  1019.       starty = y = (rect->r_height - (N_SLOTS * dayslot_height)) / 2;
  1020.   
  1021.       /* Format daystring to say, for example, */
  1022. !     /* Tuesday, March 12, 1985 */
  1023. !     sprintf(daystring, "%s %s %d, %d",
  1024. !         daynames[current.tm_wday], monthnames[current.tm_mon],
  1025. !         current.tm_mday, 1900 + current.tm_year);
  1026.       pw_text(main_pixwin, (rect->r_width - bigfont->pf_defaultsize.x*strlen(daystring))/2, starty/2 + 7,
  1027.         PIX_SRC, bigfont, daystring);
  1028.   
  1029.  
  1030. --- 121,136 -----
  1031.       starty = y = (rect->r_height - (N_SLOTS * dayslot_height)) / 2;
  1032.   
  1033.       /* Format daystring to say, for example, */
  1034. !     if (day_first)
  1035. !         /* Tuesday, 13 March 1990 */
  1036. !         sprintf(daystring, "%s %d %s %d",
  1037. !             daynames[current.tm_wday], current.tm_mday,
  1038. !             monthnames[current.tm_mon], 1900 + current.tm_year);
  1039. !     else
  1040. !         /* Tuesday, March 13, 1990 */
  1041. !         sprintf(daystring, "%s %s %d, %d",
  1042. !             daynames[current.tm_wday], monthnames[current.tm_mon],
  1043. !             current.tm_mday, 1900 + current.tm_year);
  1044.       pw_text(main_pixwin, (rect->r_width - bigfont->pf_defaultsize.x*strlen(daystring))/2, starty/2 + 7,
  1045.         PIX_SRC, bigfont, daystring);
  1046.   
  1047. ***************
  1048. *** 146,154
  1049.               pw_write(main_pixwin,x,y,dayslot_width,dayslot_height,PIX_SRC,timeslot_pr,0,0);
  1050.           if (i < n_tslots) {
  1051.               /* display time */
  1052. !             sprintf(timestring, "%2d:%s",
  1053. !                 (START_HOUR+(i/2))%12 == 0 ? 12 : (START_HOUR+(i/2))%12,
  1054. !                 i%2 == 0 ? "00" : "30");
  1055.           } else if (i == n_tslots) {
  1056.               sprintf(timestring, "Notes");
  1057.           } else {
  1058.  
  1059. --- 157,170 -----
  1060.               pw_write(main_pixwin,x,y,dayslot_width,dayslot_height,PIX_SRC,timeslot_pr,0,0);
  1061.           if (i < n_tslots) {
  1062.               /* display time */
  1063. !             if (hour24)
  1064. !                 sprintf(timestring, "%2d:%s",
  1065. !                     START_HOUR+(i/2),
  1066. !                     i%2 == 0 ? "00" : "30");
  1067. !             else
  1068. !                 sprintf(timestring, "%2d:%s%s",
  1069. !                     (START_HOUR+(i/2))%12 == 0 ? 12 : (START_HOUR+(i/2))%12,
  1070. !                     i%2 == 0 ? "00" : "30", (START_HOUR+(i/2) < 12 ? "am" : "pm"));
  1071.           } else if (i == n_tslots) {
  1072.               sprintf(timestring, "Notes");
  1073.           } else {
  1074. ***************
  1075. *** 154,160
  1076.           } else {
  1077.               sprintf(timestring, "     ");
  1078.           }
  1079. !         pw_text(main_pixwin,x-8*font->pf_defaultsize.x,y+font->pf_defaultsize.y,PIX_SRC,font,timestring);
  1080.           y += dayslot_height - 1;
  1081.       }
  1082.   
  1083.  
  1084. --- 170,176 -----
  1085.           } else {
  1086.               sprintf(timestring, "     ");
  1087.           }
  1088. !         pw_text(main_pixwin,x-9*font->pf_defaultsize.x,y+font->pf_defaultsize.y,PIX_SRC,font,timestring);
  1089.           y += dayslot_height - 1;
  1090.       }
  1091.   
  1092. ***************
  1093. *** 168,173
  1094.       sun_moon_buttons(TRUE);
  1095.       print_button(TRUE);
  1096.   }
  1097.   
  1098.   
  1099.   /*
  1100.  
  1101. --- 184,190 -----
  1102.       sun_moon_buttons(TRUE);
  1103.       print_button(TRUE);
  1104.   }
  1105. + #endif  /* NOTOOL */
  1106.   
  1107.   /*
  1108.    * Fills in appointments for the day.  
  1109. ***************
  1110. *** 169,175
  1111.       print_button(TRUE);
  1112.   }
  1113.   
  1114.   /*
  1115.    * Fills in appointments for the day.  
  1116.    * The ".tmp.aptsXXXXX" file is filled out
  1117.  
  1118. --- 186,191 -----
  1119.   }
  1120.   #endif  /* NOTOOL */
  1121.   
  1122.   /*
  1123.    * Fills in appointments for the day.  
  1124.    * The ".tmp.aptsXXXXX" file is filled out
  1125. ***************
  1126. *** 182,187
  1127.       FILE *apts, *temp_apts;
  1128.       int slotno, n_arrows, i;
  1129.       int read_stat, some_appt = 0;
  1130.       struct appt_entry appt;
  1131.       struct appt_entry *nappt, *aptr;
  1132.       char buf[MAX_STRLEN], *sptr;
  1133.  
  1134. --- 198,204 -----
  1135.       FILE *apts, *temp_apts;
  1136.       int slotno, n_arrows, i;
  1137.       int read_stat, some_appt = 0;
  1138. +     int runl;
  1139.       struct appt_entry appt;
  1140.       struct appt_entry *nappt, *aptr;
  1141.       char buf[MAX_STRLEN], *sptr;
  1142. ***************
  1143. *** 235,241
  1144.       /*
  1145.        * now go thru the appointments file
  1146.        */
  1147. !     while ((read_stat=get_aentry(apts, &appt)) != EOF) {
  1148.           if (read_stat)
  1149.               continue;    /* read error (ignore) */
  1150.           if (appt.flags & A_COMMENT) {
  1151.  
  1152. --- 252,258 -----
  1153.       /*
  1154.        * now go thru the appointments file
  1155.        */
  1156. !     while ((read_stat=get_aentry(apts, &appt, FALSE)) != EOF) {
  1157.           if (read_stat)
  1158.               continue;    /* read error (ignore) */
  1159.           if (appt.flags & A_COMMENT) {
  1160. ***************
  1161. *** 256,263
  1162.               current.tm_mday = First.tm_mday;
  1163.           else if (appt.flags & EVERY_SOMEDAY) {
  1164.               if (Pickday(appt.flags) == First.tm_wday) {
  1165. !                 if (chk_week(appt.repeat, First.tm_mday))
  1166. !                     current.tm_mday = First.tm_mday;
  1167.               }
  1168.           } else if (appt.flags & REPEAT) {
  1169.               while (ymd_compare(current, First) < 0) {
  1170.  
  1171. --- 273,284 -----
  1172.               current.tm_mday = First.tm_mday;
  1173.           else if (appt.flags & EVERY_SOMEDAY) {
  1174.               if (Pickday(appt.flags) == First.tm_wday) {
  1175. !                 if (chk_week(appt.repeat, First.tm_mday)) {
  1176. !                     if (appt.flags & RUN)
  1177. !                         find_date(&appt);
  1178. !                     else
  1179. !                         current.tm_mday = First.tm_mday;
  1180. !                 }
  1181.               }
  1182.           } else if (appt.flags & REPEAT) {
  1183.               if (appt.flags & RUN)
  1184. ***************
  1185. *** 260,268
  1186.                       current.tm_mday = First.tm_mday;
  1187.               }
  1188.           } else if (appt.flags & REPEAT) {
  1189. !             while (ymd_compare(current, First) < 0) {
  1190. !                 current.tm_mday += appt.repeat;
  1191. !                 fix_current_day();
  1192.               }
  1193.           }
  1194.           if (ymd_compare(current, First) == 0) {
  1195.  
  1196. --- 281,297 -----
  1197.                   }
  1198.               }
  1199.           } else if (appt.flags & REPEAT) {
  1200. !             if (appt.flags & RUN)
  1201. !                 runl = appt.runlength;
  1202. !             else
  1203. !                 runl = 1;
  1204. !             while (ymd_compare(current, First) < 0 && runl) {
  1205. !                 if (appt.flags & RUN)
  1206. !                     --runl;
  1207. !                 if (runl) {
  1208. !                     current.tm_mday += appt.repeat;
  1209. !                     fix_current_day();
  1210. !                 }
  1211.               }
  1212.           }
  1213.           if (ymd_compare(current, First) == 0) {
  1214. ***************
  1215. *** 267,273
  1216.           }
  1217.           if (ymd_compare(current, First) == 0) {
  1218.               /* if it's for this day, fill in slot info */
  1219. !             if (appt.flags & A_NOTE)
  1220.                   /* notes section */
  1221.                   add_note(&appt);
  1222.               else {
  1223.  
  1224. --- 296,302 -----
  1225.           }
  1226.           if (ymd_compare(current, First) == 0) {
  1227.               /* if it's for this day, fill in slot info */
  1228. !             if (appt.flags & A_NOTE) {
  1229.                   /* notes section */
  1230.                   add_note(&appt);
  1231.                   if (appt.flags & MARKED)
  1232. ***************
  1233. *** 270,276
  1234.               if (appt.flags & A_NOTE)
  1235.                   /* notes section */
  1236.                   add_note(&appt);
  1237. !             else {
  1238.                   /* regular appointment */
  1239.                   slotno = (appt.hour-START_HOUR) * 2 + appt.minute / 30;
  1240.                   if (slotno < 0)
  1241.  
  1242. --- 299,311 -----
  1243.               if (appt.flags & A_NOTE) {
  1244.                   /* notes section */
  1245.                   add_note(&appt);
  1246. !                 if (appt.flags & MARKED)
  1247. !                     /* marked note */
  1248. !                     some_appt |= SOME_MKNOTES;
  1249. !                 else
  1250. !                     /* regular note */
  1251. !                     some_appt |= SOME_NOTES;
  1252. !             } else {
  1253.                   /* regular appointment */
  1254.                   slotno = (appt.hour-START_HOUR) * 2 + appt.minute / 30;
  1255.                   if (slotno < 0)
  1256. ***************
  1257. *** 280,285
  1258.                   /* add this appt to the list of appts for the slot */
  1259.                   /* and update all the reference counts */
  1260.                   add_to_slot(slotno, &appt, FALSE);
  1261.               }
  1262.           } else if (appt.flags & LOOKAHEAD) {
  1263.               /* This lookahead appt was not for today, so
  1264.  
  1265. --- 315,321 -----
  1266.                   /* add this appt to the list of appts for the slot */
  1267.                   /* and update all the reference counts */
  1268.                   add_to_slot(slotno, &appt, FALSE);
  1269. +                 some_appt |= SOME_APPTS;
  1270.               }
  1271.           } else if (appt.flags & LOOKAHEAD) {
  1272.               /* This lookahead appt was not for today, so
  1273. ***************
  1274. *** 316,321
  1275.                       future[findex].month = save_day.tm_mon;
  1276.                       future[findex].day = save_day.tm_mday;
  1277.                       ++findex;
  1278.                   }
  1279.               }
  1280.                   } else {     /* line is not for today */
  1281.  
  1282. --- 352,358 -----
  1283.                       future[findex].month = save_day.tm_mon;
  1284.                       future[findex].day = save_day.tm_mday;
  1285.                       ++findex;
  1286. +                     some_appt |= SOME_FUTURES;
  1287.                   }
  1288.               }
  1289.                   } else {     /* line is not for today */
  1290. ***************
  1291. *** 334,350
  1292.           fclose(apts);             
  1293.       current = First;
  1294.       fix_current_day();
  1295. !     /* now check to see if there is anything happening this day */
  1296. !     if (findex)
  1297. !         some_appt = 1;
  1298. !     else {
  1299. !         for (i=0; i<N_SLOTS; i++) {
  1300. !             if (slots[i].count > 0) {
  1301. !                 some_appt = 1;
  1302. !                 break;
  1303. !             }
  1304. !         }
  1305. !     }
  1306.       return(some_appt);
  1307.   }
  1308.   
  1309.  
  1310. --- 371,377 -----
  1311.           fclose(apts);             
  1312.       current = First;
  1313.       fix_current_day();
  1314.       return(some_appt);
  1315.   }
  1316.   
  1317. ***************
  1318. *** 380,385
  1319.   struct appt_entry *appt;
  1320.   {
  1321.       struct tm save;
  1322.   
  1323.       save = current;
  1324.       /* set current to match dow of repeated appt */
  1325.  
  1326. --- 407,413 -----
  1327.   struct appt_entry *appt;
  1328.   {
  1329.       struct tm save;
  1330. +     int runl;
  1331.   
  1332.       save = current;
  1333.       /* set current to match dow of repeated appt */
  1334. ***************
  1335. *** 390,395
  1336.           current.tm_mday += 7;
  1337.           fix_current_day();
  1338.       }
  1339.       /* search for first matching week */
  1340.       while (!chk_week(appt->repeat, current.tm_mday)) {
  1341.           current.tm_mday += 7;
  1342.  
  1343. --- 418,427 -----
  1344.           current.tm_mday += 7;
  1345.           fix_current_day();
  1346.       }
  1347. +     if (appt->flags & RUN)
  1348. +         runl = appt->runlength;
  1349. +     else
  1350. +         runl = 1;
  1351.       /* search for first matching week */
  1352.       while (!chk_week(appt->repeat, current.tm_mday) && runl) {
  1353.           current.tm_mday += 7;
  1354. ***************
  1355. *** 391,397
  1356.           fix_current_day();
  1357.       }
  1358.       /* search for first matching week */
  1359. !     while (!chk_week(appt->repeat, current.tm_mday)) {
  1360.           current.tm_mday += 7;
  1361.           fix_current_day();
  1362.       }
  1363.  
  1364. --- 423,429 -----
  1365.       else
  1366.           runl = 1;
  1367.       /* search for first matching week */
  1368. !     while (!chk_week(appt->repeat, current.tm_mday) && runl) {
  1369.           current.tm_mday += 7;
  1370.           fix_current_day();
  1371.           if (appt->flags & RUN)
  1372. ***************
  1373. *** 394,399
  1374.       while (!chk_week(appt->repeat, current.tm_mday)) {
  1375.           current.tm_mday += 7;
  1376.           fix_current_day();
  1377.       }
  1378.       /* now check to make sure this is legal, i.e. there
  1379.        * were no month or year restrictions
  1380.  
  1381. --- 426,433 -----
  1382.       while (!chk_week(appt->repeat, current.tm_mday) && runl) {
  1383.           current.tm_mday += 7;
  1384.           fix_current_day();
  1385. +         if (appt->flags & RUN)
  1386. +             --runl;
  1387.       }
  1388.       /* now check to make sure this is legal, i.e. there
  1389.        * were no month or year restrictions and runlength
  1390. ***************
  1391. *** 396,402
  1392.           fix_current_day();
  1393.       }
  1394.       /* now check to make sure this is legal, i.e. there
  1395. !      * were no month or year restrictions
  1396.        */
  1397.       if ((!(appt->flags & ALL_YEARS) && current.tm_year != save.tm_year)
  1398.          || (!(appt->flags & ALL_MONTHS) && current.tm_mon != save.tm_mon))
  1399.  
  1400. --- 430,437 -----
  1401.               --runl;
  1402.       }
  1403.       /* now check to make sure this is legal, i.e. there
  1404. !      * were no month or year restrictions and runlength
  1405. !      * wasn't exceeded
  1406.        */
  1407.       if (!runl || (!(appt->flags & ALL_YEARS) && current.tm_year != save.tm_year)
  1408.          || (!(appt->flags & ALL_MONTHS) && current.tm_mon != save.tm_mon))
  1409. ***************
  1410. *** 398,404
  1411.       /* now check to make sure this is legal, i.e. there
  1412.        * were no month or year restrictions
  1413.        */
  1414. !     if ((!(appt->flags & ALL_YEARS) && current.tm_year != save.tm_year)
  1415.          || (!(appt->flags & ALL_MONTHS) && current.tm_mon != save.tm_mon))
  1416.           /* invalid date, due to month or year wrap */
  1417.           current = save;
  1418.  
  1419. --- 433,439 -----
  1420.        * were no month or year restrictions and runlength
  1421.        * wasn't exceeded
  1422.        */
  1423. !     if (!runl || (!(appt->flags & ALL_YEARS) && current.tm_year != save.tm_year)
  1424.          || (!(appt->flags & ALL_MONTHS) && current.tm_mon != save.tm_mon))
  1425.           /* invalid date, due to month or year wrap */
  1426.           current = save;
  1427. ***************
  1428. *** 409,415
  1429.   add_note(appt)
  1430.   struct appt_entry *appt;
  1431.   {
  1432. !     int    slotno;
  1433.   
  1434.       /* auto-hunt for free note slot */
  1435.       for (slotno=n_tslots; slotno<N_SLOTS; slotno++)
  1436.  
  1437. --- 444,451 -----
  1438.   add_note(appt)
  1439.   struct appt_entry *appt;
  1440.   {
  1441. !     int    slotno, found = 0;
  1442. !     struct appt_entry *optr;
  1443.   
  1444.       /* This used to just find a free slot and add the note
  1445.        * to it. However, with deleted notes we need to find
  1446. ***************
  1447. *** 411,420
  1448.   {
  1449.       int    slotno;
  1450.   
  1451. !     /* auto-hunt for free note slot */
  1452. !     for (slotno=n_tslots; slotno<N_SLOTS; slotno++)
  1453. !         if (slots[slotno].active == INACTIVE)
  1454. !             break;
  1455.       if (slotno == N_SLOTS) {
  1456.           /* overflow of notes field, so
  1457.            * add to last note field list
  1458.  
  1459. --- 447,484 -----
  1460.       int    slotno, found = 0;
  1461.       struct appt_entry *optr;
  1462.   
  1463. !     /* This used to just find a free slot and add the note
  1464. !      * to it. However, with deleted notes we need to find
  1465. !      * the matching slotno (if it exists) to make sure that
  1466. !      * the deleted and non-deleted notes end up in the same
  1467. !      * slot number (so they won't be displayed).
  1468. !      */
  1469. !     if (appt->flags & DELETED) {
  1470. !         /* look for matching non-deleted note */
  1471. !         for (slotno=n_tslots; slotno<N_SLOTS && !found; slotno++) {
  1472. !             if (slots[slotno].active == INACTIVE)
  1473. !                 break;    /* no more notes */
  1474. !             for (optr=slots[slotno].first;optr;optr=optr->next) {
  1475. !                 if (!strcmp(appt->str, optr->str) && !(optr->flags & DELETED)) {
  1476. !                     found = 1;
  1477. !                     break;
  1478. !                 }
  1479. !             }
  1480. !         }
  1481. !     } else {
  1482. !         /* look for matching deleted note */
  1483. !         for (slotno=n_tslots; slotno<N_SLOTS && !found; slotno++) {
  1484. !             if (slots[slotno].active == INACTIVE)
  1485. !                 break;    /* no more notes */
  1486. !             for (optr=slots[slotno].first;optr;optr=optr->next)
  1487. !                 if (!strcmp(appt->str, optr->str) && (optr->flags & DELETED)) {
  1488. !                     found = 1;
  1489. !                     break;
  1490. !                 }
  1491. !         }
  1492. !     }
  1493. !     if (found)
  1494. !         --slotno;  /* for loop incremented slotno */
  1495.       if (slotno == N_SLOTS) {
  1496.           /* overflow of notes field, so
  1497.            * add to last note field list
  1498. ***************
  1499. *** 424,429
  1500.       add_to_slot(slotno, appt, FALSE);
  1501.   }
  1502.   
  1503.   /* draw in todays appointments */
  1504.   draw_day_appts()
  1505.   {
  1506.  
  1507. --- 488,494 -----
  1508.       add_to_slot(slotno, appt, FALSE);
  1509.   }
  1510.   
  1511. + #ifndef NOTOOL
  1512.   /* draw in todays appointments */
  1513.   draw_day_appts()
  1514.   {
  1515. ***************
  1516. *** 555,560
  1517.           }
  1518.       }
  1519.   }
  1520.   
  1521.   /*
  1522.    * Add an appointment entry pointed to by aptr to the day slot
  1523.  
  1524. --- 620,626 -----
  1525.           }
  1526.       }
  1527.   }
  1528. + #endif  /* NOTOOL */
  1529.   
  1530.   /*
  1531.    * Add an appointment entry pointed to by aptr to the day slot
  1532. ***************
  1533. *** 600,606
  1534.       n_arrows = nappt->arrows;
  1535.       if (nappt->flags & DELETED) {
  1536.           /* look for matching non-deleted appt in list */
  1537. !         for (optr=slots[slotno].first;optr;optr=optr->next)
  1538.               if (!strcmp(nappt->str, optr->str) && !(optr->flags & DELETED)) {
  1539.                   found = 1;
  1540.                   break;
  1541.  
  1542. --- 666,672 -----
  1543.       n_arrows = nappt->arrows;
  1544.       if (nappt->flags & DELETED) {
  1545.           /* look for matching non-deleted appt in list */
  1546. !         for (optr=slots[slotno].first;optr && !found;optr=optr->next)
  1547.               if (!strcmp(nappt->str, optr->str) && !(optr->flags & DELETED)) {
  1548.                   found = 1;
  1549.                   break;
  1550. ***************
  1551. *** 645,651
  1552.           }
  1553.       } else {
  1554.           /* look for matching deleted appt in list */
  1555. !         for (optr=slots[slotno].first;optr;optr=optr->next)
  1556.               if (!strcmp(nappt->str, optr->str) && optr->flags & DELETED) {
  1557.                   found = 1;
  1558.                   break;
  1559.  
  1560. --- 711,717 -----
  1561.           }
  1562.       } else {
  1563.           /* look for matching deleted appt in list */
  1564. !         for (optr=slots[slotno].first;optr && !found;optr=optr->next)
  1565.               if (!strcmp(nappt->str, optr->str) && optr->flags & DELETED) {
  1566.                   found = 1;
  1567.                   break;
  1568. *** /tmp/,RCSt1a16937    Fri Dec 15 17:22:58 1989
  1569. --- event.c    Fri Dec 15 17:17:33 1989
  1570. ***************
  1571. *** 1,5
  1572.   /*
  1573. !  * $Header: event.c,v 2.1 89/05/09 14:23:23 billr Exp $
  1574.    */
  1575.   /*
  1576.    * event.c
  1577.  
  1578. --- 1,5 -----
  1579.   /*
  1580. !  * $Header: event.c,v 2.2 89/12/15 17:17:30 billr Exp $
  1581.    */
  1582.   /*
  1583.    * event.c
  1584. ***************
  1585. *** 40,46
  1586.   extern Frame fframe, sframe, mframe;
  1587.   extern struct tm olddate;
  1588.   extern int update_interval, show_time;
  1589. ! extern char timestr[], todays_date[];
  1590.   extern Icon icon;
  1591.   Notify_value myframe_interposer();
  1592.   
  1593.  
  1594. --- 40,46 -----
  1595.   extern Frame fframe, sframe, mframe;
  1596.   extern struct tm olddate;
  1597.   extern int update_interval, show_time;
  1598. ! extern char timestr[];
  1599.   extern Icon icon;
  1600.   extern int monday_first, hour24;
  1601.   extern Pixfont *sfont;
  1602. ***************
  1603. *** 42,47
  1604.   extern int update_interval, show_time;
  1605.   extern char timestr[], todays_date[];
  1606.   extern Icon icon;
  1607.   Notify_value myframe_interposer();
  1608.   
  1609.   void
  1610.  
  1611. --- 42,49 -----
  1612.   extern int update_interval, show_time;
  1613.   extern char timestr[];
  1614.   extern Icon icon;
  1615. + extern int monday_first, hour24;
  1616. + extern Pixfont *sfont;
  1617.   Notify_value myframe_interposer();
  1618.   
  1619.   void
  1620. ***************
  1621. *** 120,125
  1622.                       (y <= week_arrows[i].bottom))  {
  1623.               week_index = i;
  1624.               current.tm_mday = -current.tm_wday + 1 + (7 * week_index);
  1625.                           selected_type = WEEK;
  1626.                           pw_write(main_pixwin,week_arrows[week_index].left,
  1627.                             week_arrows[week_index].top,smallarrow_pr->pr_size.x,
  1628.  
  1629. --- 122,129 -----
  1630.                       (y <= week_arrows[i].bottom))  {
  1631.               week_index = i;
  1632.               current.tm_mday = -current.tm_wday + 1 + (7 * week_index);
  1633. +             if (monday_first)
  1634. +                 current.tm_mday++;
  1635.                           selected_type = WEEK;
  1636.                           pw_write(main_pixwin,week_arrows[week_index].left,
  1637.                             week_arrows[week_index].top,smallarrow_pr->pr_size.x,
  1638. ***************
  1639. *** 211,217
  1640.           sframe_done(0);
  1641.   #endif
  1642.       check_calendar();    /* update icon */
  1643. !     if (show_time) {
  1644.           /* update time label */
  1645.           strcpy(timestr, todays_date+10);
  1646.           if (update_interval == 60)
  1647.  
  1648. --- 215,221 -----
  1649.           sframe_done(0);
  1650.   #endif
  1651.       check_calendar();    /* update icon */
  1652. !     if (show_time)
  1653.           /* update time label */
  1654.           update_icon_time();
  1655.   }
  1656. ***************
  1657. *** 213,227
  1658.       check_calendar();    /* update icon */
  1659.       if (show_time) {
  1660.           /* update time label */
  1661. !         strcpy(timestr, todays_date+10);
  1662. !         if (update_interval == 60)
  1663. !             /* display hh:mm */
  1664. !             timestr[6] = '\0';
  1665. !         else
  1666. !             /* display hh:mm:ss */
  1667. !             timestr[9] = '\0';
  1668. !         cur_icon = (Icon) window_get(frame, FRAME_ICON);
  1669. !         icon_set(cur_icon, ICON_LABEL, timestr, 0);
  1670. !         window_set(frame, FRAME_ICON, cur_icon, 0);
  1671.       }
  1672.   }
  1673.  
  1674. --- 217,256 -----
  1675.       check_calendar();    /* update icon */
  1676.       if (show_time)
  1677.           /* update time label */
  1678. !         update_icon_time();
  1679. ! }
  1680. ! /* update the time field of the current icon */
  1681. ! update_icon_time()
  1682. ! {
  1683. !     Icon cur_icon;
  1684. !     format_icon_time();
  1685. !     cur_icon = (Icon) window_get(frame, FRAME_ICON);
  1686. !     icon_set(cur_icon, ICON_LABEL, timestr, 0);
  1687. !     window_set(frame, FRAME_ICON, cur_icon, 0);
  1688. ! }
  1689. ! format_icon_time()
  1690. ! {
  1691. !     if (update_interval >= 60)
  1692. !         /* display hh:mm */
  1693. !         sprintf(timestr, " %2d:%02d", today.tm_hour, today.tm_min);
  1694. !     else
  1695. !         /* display hh:mm:ss */
  1696. !         sprintf(timestr, " %2d:%02d:%02d", today.tm_hour, today.tm_min, today.tm_sec);
  1697. !     if (!hour24) {
  1698. !         /* display am/pm for 12-hour time */
  1699. !         if (today.tm_hour > 12) {
  1700. !             strcat(timestr, "pm");
  1701. !             timestr[1] = ((today.tm_hour - 12) / 10) + '0';
  1702. !             timestr[2] = ((today.tm_hour - 12) % 10) + '0';
  1703. !         } else if (today.tm_hour == 12) {
  1704. !             strcat(timestr, "pm");
  1705. !         } else {
  1706. !             strcat(timestr, "am");
  1707. !         }
  1708. !         if (timestr[1] == '0')
  1709. !             timestr[1] = ' ';
  1710.       }
  1711.   }
  1712. *** /tmp/,RCSt1a24048    Mon Dec 18 17:14:37 1989
  1713. --- dates/space    Mon Dec 18 17:13:53 1989
  1714. ***************
  1715. *** 1,5
  1716.   # CalenTool V2 - DO NOT REMOVE THIS LINE
  1717. ! # $Header: space,v 1.2 89/08/25 11:18:46 billr Exp $
  1718.   # Special days file for calentool (rel 2.1)
  1719.   # Submitted by Steve Gilbreath <steve@prism.gatech.edu>
  1720.   # Space events of note
  1721.  
  1722. --- 1,5 -----
  1723.   # CalenTool V2 - DO NOT REMOVE THIS LINE
  1724. ! # $Header: space,v 2.1 89/12/18 17:13:32 billr Exp $
  1725.   # Special days file for calentool (rel 2.1)
  1726.   # Submitted by Steve Gilbreath <steve@prism.gatech.edu>
  1727.   # Space events of note
  1728. ***************
  1729. *** 111,117
  1730.   ** 04 20 99 99 00 Soyuz T-8 launched; mission aborted when capsule failed to dock with Salyut station. (1983)
  1731.   ** 04 23 99 99 00 Advisory council for Aeronautics became National Advisory Council on Aeronautics (NACA). (1915)
  1732.   ** 04 23 99 99 00 Launch of 1st Soviet communications satelite. (1965)
  1733. ! ** 04 23 99 99 00 USSR Soyus 1 launched with Vladimir Komarov becoming the 1st cosomonaut to make 2 flights. He also became 1st man to die in space after his parachute line tangled on re-entry.  Soyus 1.  All Soviet manned flights ceased for 18 months.
  1734.  (1967)
  1735.   ** 04 24 99 99 00 China becomes 5th nation to launch artificial satellite. (1970)
  1736.   ** 04 25 99 99 00 Mercury/Atlas rocket lifted off with an electronic mannequin; when inertial guidance system failed 40 seconds after launch the rocket was destroyed by range safety officer. (1961)
  1737.   ** 04 26 99 99 00 US/UK launched Ariel; 1st International payload. (1962)
  1738.  
  1739. --- 111,117 -----
  1740.   ** 04 20 99 99 00 Soyuz T-8 launched; mission aborted when capsule failed to dock with Salyut station. (1983)
  1741.   ** 04 23 99 99 00 Advisory council for Aeronautics became National Advisory Council on Aeronautics (NACA). (1915)
  1742.   ** 04 23 99 99 00 Launch of 1st Soviet communications satelite. (1965)
  1743. ! ** 04 23 99 99 00 USSR Soyus 1 launched with Vladimir Komarov becoming the 1st cosomonaut to make 2 flights. Also became 1st man to die in space after his parachute line tangled on re-entry. All Soviet manned flights ceased for 18 months. (1967)
  1744.   ** 04 24 99 99 00 China becomes 5th nation to launch artificial satellite. (1970)
  1745.   ** 04 25 99 99 00 Mercury/Atlas rocket lifted off with an electronic mannequin; when inertial guidance system failed 40 seconds after launch the rocket was destroyed by range safety officer. (1961)
  1746.   ** 04 26 99 99 00 US/UK launched Ariel; 1st International payload. (1962)
  1747. *** /tmp/,RCSt1a24057    Mon Dec 18 17:15:10 1989
  1748. --- dates/world    Mon Dec 18 17:14:16 1989
  1749. ***************
  1750. *** 1,5
  1751.   # CalenTool V2 - DO NOT REMOVE THIS LINE
  1752. ! # $Header: world,v 2.2 89/05/16 10:46:16 billr Exp $
  1753.   # Special days file for calentool (rel 2.1); modified from network posting by
  1754.   # RPC Rodgers, UCSF, Nov. 1988
  1755.   # Various holidays commemorated around the world (non-US and Canadian)
  1756.  
  1757. --- 1,5 -----
  1758.   # CalenTool V2 - DO NOT REMOVE THIS LINE
  1759. ! # $Header: world,v 2.3 89/12/18 17:14:00 billr Exp $
  1760.   # Special days file for calentool (rel 2.1); modified from network posting by
  1761.   # RPC Rodgers, UCSF, Nov. 1988
  1762.   # Various holidays commemorated around the world (non-US and Canadian)
  1763. ***************
  1764. *** 41,47
  1765.   ** 01 23 99 99 00 Feast of St. Ildefonsus
  1766.   ** 01 24 99 99 00 Economic Liberation Day (Togo)
  1767.   ** 01 26 99 99 00 Republic Day (India)
  1768. ! ** 01 30 99 99 00 Australia Day (Australia)
  1769.   ** 02 01 99 99 00 Chinese New Year Holiday (3 days) (Taiwan)
  1770.   ** 02 03 99 99 00 Setsubun, Change of Season or "Bean Throwing Night" (Japan)
  1771.   ** 02 04 99 99 00 Independence Commemoration Day (Sri Lanka)
  1772.  
  1773. --- 41,47 -----
  1774.   ** 01 23 99 99 00 Feast of St. Ildefonsus
  1775.   ** 01 24 99 99 00 Economic Liberation Day (Togo)
  1776.   ** 01 26 99 99 00 Republic Day (India)
  1777. ! ** 01 26 99 99 00 Australia Day (Australia)
  1778.   ** 02 01 99 99 00 Chinese New Year Holiday (3 days) (Taiwan)
  1779.   ** 02 03 99 99 00 Setsubun, Change of Season or "Bean Throwing Night" (Japan)
  1780.   ** 02 04 99 99 00 Independence Commemoration Day (Sri Lanka)
  1781. ***************
  1782. *** 366,372
  1783.   ** 09 30 99 99 00 Botswanna Day (Botswanna)
  1784.   ** 10 01 99 99 00 Armed Forces Day (South Korea)
  1785.   ** 10 01 99 99 00 Independence Day (Nigeria)
  1786. ! ** 10 01 99 99 00 Labor Day (Australia)
  1787.   ** 10 01 99 99 00 National Liberation Day (2 days) (China)
  1788.   ** 10 01 99 99 00 Public Holiday (Botswanna)
  1789.   ** 10 02 99 99 00 Anniversary of Guinean Independence (Guinea)
  1790.  
  1791. --- 366,372 -----
  1792.   ** 09 30 99 99 00 Botswanna Day (Botswanna)
  1793.   ** 10 01 99 99 00 Armed Forces Day (South Korea)
  1794.   ** 10 01 99 99 00 Independence Day (Nigeria)
  1795. ! #** 10 01 99 99 00 Labor Day (Australia) [really 1st Monday in October]
  1796.   ** 10 01 99 99 00 National Liberation Day (2 days) (China)
  1797.   ** 10 01 99 99 00 Public Holiday (Botswanna)
  1798.   ** 10 02 99 99 00 Anniversary of Guinean Independence (Guinea)
  1799.