home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / source / remind23.lzh / remind.4 / defines.h < prev    next >
C/C++ Source or Header  |  1991-02-24  |  2KB  |  65 lines

  1. /***************************************************************/
  2. /*                                                             */
  3. /*  DEFINES.H                                                  */
  4. /*                                                             */
  5. /*  Contains macros and #defines for REMIND program.           */
  6. /*                                                             */
  7. /*  By David Skoll - 30 Sept 1990.                             */
  8. /*                                                             */
  9. /***************************************************************/
  10.  
  11. /* User-definable variables.  BASE *must* be a year for which the
  12.    first of January is a Monday!!!  FOMITSIZE and POMITSIZE control
  13.    the number of fully-specified (dd-mm-yy) and partially-specified
  14.    (dd-mm) holidays. */
  15. #define BASE 1990
  16. #define FOMITSIZE 150
  17. #define POMITSIZE 75
  18.  
  19. /* Useful macros */
  20.  
  21. #define upper(c) ( ((c) >= 'a' && (c) <= 'z') ? ((c)-32) : (c) )
  22. #define DaysInYear(y) (((y) % 4) ? 365 : ((!((y) % 100) && ((y) % 400)) ? 365 : 366 ))
  23. #define IsLeapYear(y) (((y) % 4) ? 0 : ((!((y) % 100) && ((y) % 400)) ? 0 : 1 ))
  24. #define DaysInMonth(m, y) ((m) != 1 ? MonthDays[m] : 28 + IsLeapYear(y))
  25. #define TimeLess(h1, m1, h2, m2) (((h1) < (h2)) || (((h1) == (h2)) && ((m1) < (m2))))
  26. #define MAX(x, y) ((x) < (y) ? (y) : (x))
  27. #define MIN(x, y) ((x) < (y) ? (x) : (y))
  28. #ifndef ABS
  29. #define ABS(x) ((x) < 0 ? (-(x)) : (x))
  30. #endif
  31.  
  32. /* Bit masks for constraint map */
  33. #define DAY_M 1
  34. #define MONTH_M 2
  35. #define YEAR_M 4
  36. #define WKDAY_M 8
  37.  
  38. enum Token_t { Unknown_t, Year_t, Month_t, Day_t, WkDay_t, Msg_t, Run_t,
  39.            Omit_t, Banner_t, Rem_t, Delta_t, Back_t, Once_t, Include_t,
  40.                Repeat_t, At_t, Time_t, Skip_t, Until_t, Push_t, Pop_t,
  41.            Clear_t, Eol_t };
  42.  
  43. /* Define the Token structure */
  44.  
  45. typedef struct {
  46.    char *str;
  47.    enum Token_t type;
  48.    int val;
  49.    char len;    /* Minimum length to match */
  50. } Token;
  51.  
  52. #ifdef UNIX
  53. /* Define the structure of an AT entry */
  54. typedef struct AtEntry_t{
  55.    int time;      /* Time in minutes after midnight - 0 to 1439 */
  56.    int firsttime; /* Time of first triggering */
  57.    int repeat;    /* Repeat period */
  58.    int delta;     /* Delta time */
  59.    enum Token_t type;    /* Run_t or Msg_t */
  60.    char *text;
  61.    struct AtEntry_t *next;
  62. } AtEntry;
  63. #endif
  64.  
  65.