/* <libdtdef.h>
 *
 *	Interface definitions for LIB$DT (date/time) package
 */
#ifndef _LIBDTDEF_H
#define _LIBDTDEF_H

/* request codes for LIB$INIT_DATE_TIME_CONTEXT */
#define LIB$K_MONTH_NAME	0	/* pre-init the month names */
#define LIB$K_MONTH_NAME_ABB	3	/* pre-init the month name abbreviations */
#define LIB$K_WEEKDAY_NAME	6	/* pre-init the weekday names */
#define LIB$K_WEEKDAY_NAME_ABB	9	/* pre-init the weekday name abbreviations */
#define LIB$K_MERIDIEM_INDICATOR 12	/* pre-init the AM/PM names */
#define LIB$K_OUTPUT_FORMAT	1	/* pre-init the output format */
#define LIB$K_INPUT_FORMAT	2	/* pre-init the input format */
#define LIB$K_RELATIVE_DAY_NAME 15	/* pre-init "TODAY", etc */
#define LIB$K_FORMAT_MNEMONICS	18	/* pre-init MM, DD, YYYY, etc */
#define LIB$K_LANGUAGE		4	/* pre-init user's language */

/* operation codes (flags) for date time conversion routines */
#define LIB$K_MONTH_OF_YEAR	1	/* requests output in units of month of year */
#define LIB$K_DAY_OF_YEAR	2	/* requests output in days of year 1-366 */
#define LIB$K_HOUR_OF_YEAR	3	/* requests output in hours of year 1-8784 */
#define LIB$K_MINUTE_OF_YEAR	4	/* requests output in minutes of year 1-527040 */
#define LIB$K_SECOND_OF_YEAR	5	/* requests output in seconds of year 1-31622400 */
#define LIB$K_DAY_OF_MONTH	6	/* request output in days of month 1-31 */
#define LIB$K_HOUR_OF_MONTH	7	/* request output in hours of month 1-744 */
#define LIB$K_MINUTE_OF_MONTH	8	/* request output in minutes of month 1-44640 */
#define LIB$K_SECOND_OF_MONTH	9	/* requests output in seconds of month 1-2678400 */
#define LIB$K_DAY_OF_WEEK	10	/* requests output in days of week 1-7 with monday = 1 */
#define LIB$K_HOUR_OF_WEEK	11	/* requests output in hours of week 1-168 */
#define LIB$K_MINUTE_OF_WEEK	12	/* requests in minutes of week 1-10080 */
#define LIB$K_SECOND_OF_WEEK	13	/* requests output in seconds of week 1-604800 */
#define LIB$K_HOUR_OF_DAY	14	/* requests output in hours of day 1-24 */
#define LIB$K_MINUTE_OF_DAY	15	/* requests output in minutes of day 1-1440 */
#define LIB$K_SECOND_OF_DAY	16	/* requests output in seconds of day 1-3600 */
#define LIB$K_MINUTE_OF_HOUR	17	/* requests output in minutes of hour 1-60 */
#define LIB$K_SECOND_OF_HOUR	18	/* requests output in minutes of hour 1-3600 */
#define LIB$K_SECOND_OF_MINUTE	19	/* requests output in seconds of minutes 1-60 */
#define LIB$K_JULIAN_DATE	20	/* requests output as a julian day number */
#define LIB$K_DELTA_WEEKS	21	/* input/output in terms of delta weeks */
#define LIB$K_DELTA_DAYS	22	/* input/output in terms of delta days */
#define LIB$K_DELTA_HOURS	23	/* input/output in terns of delta hours */
#define LIB$K_DELTA_MINUTES	24	/* input/output in terms of delta minutes */
#define LIB$K_DELTA_SECONDS	25	/* input/output in terms of delta seconds */
#define LIB$K_DELTA_WEEKS_F	26	/* input/output in terms of fractional delta weeks */
#define LIB$K_DELTA_DAYS_F	27	/* input/output in terms of fractional delta days */
#define LIB$K_DELTA_HOURS_F	28	/* input/output in terms of fractional delta hours */
#define LIB$K_DELTA_MINUTES_F	29	/* input/output in terms of fractional delta minutess */
#define LIB$K_DELTA_SECONDS_F	30	/* input/output in terms of fractional delta seconds */
#define LIB$K_MAX_OPERATION	31	/* 1+ max # of conversion flags */

/* masks for outputting date or time fields only */
#define LIB$V_TIME_FIELDS	0
#define LIB$V_DATE_FIELDS	1
#define LIB$M_TIME_FIELDS	(1<<LIB$V_TIME_FIELDS)		/* 0x01 */
#define LIB$M_DATE_FIELDS	(1<<LIB$V_DATE_FIELDS)		/* 0x02 */
struct dt_print_fields {
    unsigned lib$v_time_fields	: 1;	/* force printing of time fields */
    unsigned lib$v_date_fields	: 1;	/* force printing of date fields */
    unsigned			: 6;
};

/* masks for input defaulting flag longword */
#define LIB$V_YEAR	0
#define LIB$V_MONTH	1
#define LIB$V_DAY	2
#define LIB$V_HOUR	3
#define LIB$V_MINUTE	4
#define LIB$V_SECOND	5
#define LIB$V_HUNDREDTHS 6
#define LIB$M_YEAR	(1<<LIB$V_YEAR)		/* 0x01 */
#define LIB$M_MONTH	(1<<LIB$V_MONTH)	/* 0x02 */
#define LIB$M_DAY	(1<<LIB$V_DAY)		/* 0x04 */
#define LIB$M_HOUR	(1<<LIB$V_HOUR)		/* 0x08 */
#define LIB$M_MINUTE	(1<<LIB$V_MINUTE)	/* 0x10 */
#define LIB$M_SECOND	(1<<LIB$V_SECOND)	/* 0x20 */
#define LIB$M_HUNDREDTHS (1<<LIB$V_HUNDREDTHS)	/* 0x40 */
struct dt_default_fields {
    unsigned lib$v_year   : 1;		/* allow the year to be defaulted */
    unsigned lib$v_month  : 1;		/* allow the month to be defaulted */
    unsigned lib$v_day	  : 1;		/* allow the day to be defaulted */
    unsigned lib$v_hour   : 1;		/* allow the hour to be defaulted */
    unsigned lib$v_minute : 1;		/* allow the minute to be defaulted */
    unsigned lib$v_second : 1;		/* allow the second to be defaulted */
    unsigned lib$v_hundredths : 1;	/* allow the fract to be defaulted */
    unsigned		  : 1;
};

#endif	/*_LIBDTDEF_H*/
