Data structure of the "holiday data" (Ver.3.0)   29-Sep-2003
                                                 03-Oct-2003 Rev.1
                                                 12-Nov-2003 Rev.2

Database type      Data 
Creator ID         Md02 
File name          DateSpot.pdb

Record data 
1. Version number (1 record) 
  Category  1 
  Length    2bytes 
  Form      The version number of data format (=1 or 2 or 3) : (short) 
  General   The version number of the data is specified. 

2. The range of the data (1 record) 
  Category  2 
  Length    8bytes 
  Form      Starting year  : (short), 
            Starting month : (short), 
            Ending year    : (short), 
            Ending month   : (short), 
  General   The starting month of the data and the finishing month are stored. 

            This category was "a maximum 36 months" in the form version 1. 
            The "reference application" which supports a form version 2 or a form version 3
           doesn't need to refer to this category.

            When all the following conditions are satisfied with renewal software, 
           this category is made as a form of the form version 1,
           and encouraged to set "1" in the category 1. 
               (1) Three years or less than that 
               (2) Max two colors 
               (3) Version 2 format. 

3. The color of the data (1 record)
  Category  3 
  Length    6bytes + (25bytes + length of the explanation of the color(Length isn't fixed.) )
             * the number of colors 
  Form      Record length                                                              : (short),
            The number of colors                                                       : (short),
            How to express a color                                                     : (short),
            The turn of the color                                                      : (short),
            Holiday flag                                                               : (short),
            Color code (this month color)(back color)                                  : (IndexedColorType), 
            Color code (this month color)(text color)                                  : (IndexedColorType), 
            Color code (previous and next month color)(back color)                     : (IndexedColorType), 
            Color code (previous and next month color)(text color)                     : (IndexedColorType), 
            Color code (RGB designation) (this month color)(back color)                : (RGBColorType), 
            Color code (RGB designation) (this month color)(text color)                : (RGBColorType), 
            Color code (RGB designation) (previous and next month color)(back color)   : (RGBColorType), 
            Color code (RGB designation) (previous and next month color)(text color)   : (RGBColorType), 
            The length of the explanation of the color (byte)                          : (unsigned char), 
            The explanation of the color                                               : 
                           (char  Length is the number of "The length of the explanation of the color".)
  General   The color code of the data and an explanation are stored. 
            This category is the category which became addition in the form version 3. 
            "Record length" is taken in first, and then the length specified by "the record length"
           is taken in .

            Data in the head of the category 3 
              +---------------+------------------+--------------------+
              | Record length | Number of colors | Color is expressed |
              +---------------+------------------+--------------------+
              |   (16 bits)   |    (16 bits)     |     (16 bits)      |
              +---------------+------------------+--------------------+

            The data that several minutes of the color are repeated(1) 
               1-32 bit 
              +-----------------------+--------------+
              | The turn of the color | Holiday flag |
              +-----------------------+--------------+
              |       (16 bits)       |  (16 bits)   |
              +-----------------------+--------------+

               33-64 bit 
              +---------------------------------------------------------------------+
              |                              Color code                             |
              +--------------+--------------+-------------------+-------------------+
              |  This month  |  This month  | previous and next | previous and next |
              | (Back color) | (Text color) |   (Back color)    |   (Text color)    |
              +--------------+--------------+-------------------+-------------------+
              |   (8 bits)   |   (8 bits)   |      (8 bits)     |      (8 bits)     |
              +--------------+--------------+-------------------+-------------------+

               65-192 bit 
              +---------------------------------------------------------------------+
              |                             Color code (RGB)                        |
              +--------------+--------------+-------------------+-------------------+
              |  This month  |  This month  | previous and next | previous and next |
              | (Back color) | (Text color) |   (Back color)    |   (Text color)    |
              +--------------+--------------+-------------------+-------------------+
              |  (32 bits)   |  (32 bits)   |     (32 bits)     |     (32 bits)     |
              +--------------+--------------+-------------------+-------------------+

            The data that several minutes of the color are repeated(2) 
              +--------------------+--------------------------+
              | Explanation length | Explanation of the color |
              +--------------------+--------------------------+
              |      (8 bits)      |  Length of Explanation   |
              +--------------------+--------------------------+

             There is "data in the head of the category 3" (48 bits) first. 
            And "the number of colors" "the data that several minutes of the color are repeated(1)" 
            (the length of the 192 bits) is repeated. 
            And "the number of colors" "the data that several minutes of the color are repeated(2)" 
            ((the length of the 8 bits + explanation) * color no) is repeated. 
             The length specified with "Explanation length" are stored in "explanation of the color". 

             "Record length" is the number of bytes of the data including "Record length". 
            "The number of colors" is necessary by more than two colors. 
            "How to express a color"
                                  =1: It was a monochrome device to set it up. 
                                  =4: Only a code for color of 256 is supported.
                                      (For the expansion. Designation is impossible.) 
                                  =5: Only a code for color of the RGB designation is supported. 
                                      (For the expansion. Designation is impossible.) 
                                  =6: Both support of 256 and RGB. 

                      4 and 5 can't be set up in the form version 3. 

                      (=6) sets up both of the "color code" and the "color code(RGB)" in case of a color. 
                      Use WinRGBToIndex, WinIndexToRGB function, and so on. 

                      (=1) The value of the default is set on the "color code" and the "color code (RGB)".

                      Update (reference) program can decide the value of the default as the option. 

           "The turn of the color" must be equal to the ascending order from 1. 
           "Holiday flag"    =1 : holiday    =0: A memorial day on weekdays. 
           "This month" stores the color code of this month to indicate. 
           "Previous and next" stores a color code previous/next month to indicate. 
           Refer to "guideline.txt" for the method of the proper use 
          of "this month color" and "Previous and next month color". 

           The number of bytes of "the explanation of the color" is within 
          "length of the explanation of the color". It is maximum 32 bytes. 
           A string such as "a birthday", "a wedding anniversary", "red" and "green" 
          is on "the explanation of the color". 
           When "the explanation of the color" isn't defined, 
          "the length of the explanation of the color" becomes 0. 

4. Holiday data (1/ month records) 
  Category  4 
  Length    4bytes + the number of the color * 4bytes 
  Form      Year                                   : (short), 
            Month                                  : (short), 
            The number 1 of the holiday data-color : (unsigned char*4), 
            The number 2 of the holiday data-color : (unsigned char*4), 
                   :                  :
            The number 7 of the holiday data-color : (unsigned char*4) 
  General   holiday data (all the color code commonness) : 0= weekdays 1= holiday 

            One month is shown by 32 bits. Weekdays are taken if each bit is 0. 
           Holidays are taken if each bit is 1. 
            Only the number specified in "the number of the color" of
           the category 3 is defined as the holiday data.
            32 bits of the beginning (4 bytes) is the number 1 of the color. 
            32 bits of the next become data on the number 2 of the color. 
            Only the number defined with "the number of the color" is defined.
           +----+-----------------+---+---+--------------+
           |char|         0       |  1|  2|      3       |
           +----+--+--+--+--+--+--+---+---+--+--+--+--+--+
           |bit | 0| 1| 2| 3|..| 7|.......| 0|..| 5| 6| 7|
           +----+--+--+--+--+--+--+-------+--+--+--+--+--+
           |day | -|31|30|29|..|25|.......| 8|..| 3| 2| 1|
           +----+--+--+--+--+--+--+-------+--+--+--+--+--+

           Though it is possible that the same day is defined as the color
          of 2 and more.  That isn't encouraged. 
           When the same day is defined as the holiday by more than two color, 
          it gives priority to the young color of the number of the color. 

           The application must sort it in advance when data are taken in the ascending order. 
           There is no guarantee that data continue. 

           This category was "a maximum 36 records" in the form version 1. 
           As for this category, length was 12bytes (two colors) to the form version 2. 



Data structure of the "holiday data" (Ver.2.0)   01-Sep-2002
                                                 12-Nov-2003 rev.1

Database type      Data 
Creator ID         Md02 
File name          DateSpot.pdb 

Record data 
1. Version number (1 record) 
  Category  1 
  Length    2bytes 
  Form      The version number of data format (=1 or 2) : (short) 
  General   The version number of the data is specified. 

2. The range of the data (1 record)
  Category  2 
  Length    8bytes 
  Form      Starting year  : (short), 
            Starting month : (short), 
            Ending year    : (short), 
            Ending month   : (short) 
  General   The start month of the data and the finishing month are stored. 
            This category was "a maximum 36 months" with Version 1. 
            This category isn't referred to, and it is OK with Version 2. 

3. Holiday datas (1/ month records) 
  Category  4 
  Length    12bytes 
  Form      Year               : (short), 
            Month              : (short), 
            Holiday data-red   : (unsigned char*4), 
            Holiday data-green : (unsigned char*4) 
  General   Holiday data (red/green commonness) : 0= weekdays 1= holiday 

            One month is shown by 32 bits. Weekdays are taken if each bit is 0. 
           Holidays are taken if each bit is 1. 
            Holiday data can be expressed to 2 colors, and 32 bits 
           of the beginning (4 bytes) make red, 32 bits of the rest make green. 
           +----+-----------------+---+---+--------------+
           |char|         0       |  1|  2|      3       |
           +----+--+--+--+--+--+--+---+---+--+--+--+--+--+
           |bit | 0| 1| 2| 3|..| 7|.......| 0|..| 5| 6| 7|
           +----+--+--+--+--+--+--+-------+--+--+--+--+--+
           |day | -|31|30|29|..|25|.......| 8|..| 3| 2| 1|
           +----+--+--+--+--+--+--+-------+--+--+--+--+--+

                This category was "a maximum 36 records" with Version 1. 



Data structure of the "holiday data" (Ver.1.0)   08-Mar-2001
                                                 12-Nov-2003 rev.1 

Database type      Data 
Creator ID         Md02 
File name          DateSpot.pdb 

Record data 
1. Version number (1 record) 
  Category  1 
  Length    2bytes 
  Form      The version number of data format (=1) : (short) 
  General   The version number of the data is specified. 

2. The range of the data (1 record) 
  Category  2 
  Length    8bytes 
  Form      Starting year  : (short), 
            Starting month : (short), 
            Ending year    : (short), 
            Ending month   : (short) 
  General   The start month of the data and the finishing month are stored. 
            The interval of the start month and the finishing month is 
            a maximum 36 months. 

3. Holiday data (1/ month records) 
  Category  4 
  Length    12bytes 
  Form      Year               : (short), 
            Month              : (short), 
            Holiday data-red   : (unsigned char*4), 
            Holiday data-green : (unsigned char*4) 
  General   Holiday data (red/green commonness) : 0= weekdays 1= holiday 

            One month is shown by 32 bits. Weekdays are taken if each bit is 0. 
           Holidays are taken if each bit is 1. 
            Holiday data can be expressed to 2 colors, and 32 bits 
           of the beginning (4 bytes) make red, 32 bits of the rest make green. 
           +----+-----------------+---+---+--------------+
           |char|         0       |  1|  2|      3       |
           +----+--+--+--+--+--+--+---+---+--+--+--+--+--+
           |bit | 0| 1| 2| 3|..| 7|.......| 0|..| 5| 6| 7|
           +----+--+--+--+--+--+--+-------+--+--+--+--+--+
           |day | -|31|30|29|..|25|.......| 8|..| 3| 2| 1|
           +----+--+--+--+--+--+--+-------+--+--+--+--+--+

            It can be stored to the maximum 36 records. 
