home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / cnews.tar / libc / datereltoks.c < prev    next >
C/C++ Source or Header  |  1992-11-06  |  2KB  |  69 lines

  1. #include "datetok.h"
  2.  
  3. /*
  4.  * TODO: XXX indicates things that should be taken out.  A simple rule is to
  5.  * have the long form, and the single letter abbreviation (except for month)
  6.  */
  7. /* This table must be kept sorted by the first member */
  8. datetkn datereltoks[] = {
  9.     "&",        IGNORE,        0,
  10.     "a",        NUMBER,        1,
  11.     "after",    AFTER,        0,
  12.     "ago",        AGO,        1,
  13.     "an",        NUMBER,        1,
  14.     "and",        IGNORE,        0,
  15.     "before",    BEFORE,        1,
  16.     "d",        DAYS,        1,
  17.     "day",        DAYS,        1,
  18.     "days",        DAYS,        1,
  19.     "dy",        DAYS,        1,    /* XXX */
  20.     "dys",        DAYS,        1,    /* XXX */
  21.     "eighth",    ORDINAL,    8,
  22.     "eleven",    ORDINAL,    11,
  23.     "fifth",    ORDINAL,    5,
  24.     "first",    ORDINAL,    1,
  25.     "fortni",    DAYS,        14,    /* fortnight */
  26.     "fourth",    ORDINAL,    4,
  27.     "from",        AFTER,        0,
  28.     "h",        HOURS,        1,
  29.     "hence",    AGO,        0,
  30.     "hour",        HOURS,        1,
  31.     "hours",    HOURS,        1,
  32.     "hr",        HOURS,        1,    /* XXX */
  33.     "hrs",        HOURS,        1,    /* XXX */
  34.     "last",        ORDINAL,    -1,
  35.     "m",        SECONDS,    60,
  36.     "min",        SECONDS,    60,    /* XXX */
  37.     "mins",        SECONDS,    60,    /* XXX */
  38.     "minute",    SECONDS,    60,
  39.     "month",    MONTH,        1,
  40.     "months",    MONTH,        1,
  41.     "next",        NUMBER,        1,
  42.     "next",        ORDINAL,    2,    /* TODO: conflict! */
  43.     "ninth",    ORDINAL,    9,
  44.     "s",        SECONDS,    1,
  45.     "sec",        SECONDS,    1,    /* XXX */
  46. /*    "second",    ORDINAL,    2,    */
  47.     "second",    SECONDS,    1,
  48.     "secs",        SECONDS,    1,    /* XXX */
  49.     "sevent",    ORDINAL,    7,
  50.     "sixth",    ORDINAL,    6,
  51.     "tenth",    ORDINAL,    10,
  52.     "the",        IGNORE,        0,
  53.     "third",    ORDINAL,    3,
  54.     "this",        ORDINAL,    0,
  55.     "twelft",    ORDINAL,    12,
  56.     "w",        DAYS,        7,
  57.     "week",        DAYS,        7,
  58.     "weeks",    DAYS,        7,
  59.     "wk",        DAYS,        7,    /* XXX */
  60.     "wks",        DAYS,        7,    /* XXX */
  61.     "y",        YEARS,        1,
  62.     "year",        YEARS,        1,
  63.     "years",    YEARS,        1,
  64.     "yr",        YEARS,        1,    /* XXX */
  65.     "yrs",        YEARS,        1,    /* XXX */
  66. };
  67.  
  68. unsigned szdatereltoks = sizeof datereltoks / sizeof datereltoks[0];
  69.