9e3d9b130898ad5fed0d6b4794c22193800af688
[yaz-moved-to-github.git] / asn / prt-dat.h
1 /*
2  * This file is part of the YAZ toolkit:
3  * Copyright (c) 1998, Index Data.
4  * See the file LICENSE for details.
5  * Sebastian Hammer, Adam Dickmeiss
6  *
7  * Contribution by Ronald van Der Meer (RVDM):
8  *  Databasix Information Systems B.V., Utrecht, The Netherlands.
9  *
10  * $Log: prt-dat.h,v $
11  * Revision 1.1  2000-10-03 12:55:50  adam
12  * Removed several auto-generated files from CVS.
13  *
14  * Revision 1.1  1999/11/30 13:47:11  adam
15  * Improved installation. Moved header files to include/yaz.
16  *
17  * Revision 1.2  1999/04/20 09:56:48  adam
18  * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun).
19  * Modified all encoders/decoders to reflect this change.
20  *
21  * Revision 1.1  1998/02/10 15:31:52  adam
22  * Implemented date and time structure. Changed the Update Extended
23  * Service.
24  *
25  */
26
27 #ifndef __PRT_DAT_H
28 #define __PRT_DAT_H
29
30 #include <yaz/yconfig.h>
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 typedef struct Z_MonthAndDay
37 {
38     int *month;
39     int *day;                               /* OPTIONAL */
40 } Z_MonthAndDay;
41
42 typedef struct Z_Quarter
43 {
44     int which;
45 #define Z_Quarter_first         0
46 #define Z_Quarter_second        1
47 #define Z_Quarter_third         2
48 #define Z_Quarter_fourth        3
49     union
50     {
51         Odr_null *first;
52         Odr_null *second;
53         Odr_null *third;
54         Odr_null *fourth;
55     } u;
56 } Z_Quarter;
57
58 typedef struct Z_Season
59 {
60     int which;
61 #define Z_Season_winter         0
62 #define Z_Season_spring         1
63 #define Z_Season_summer         2
64 #define Z_Season_autumn         3
65     union
66     {
67         Odr_null *winter;
68         Odr_null *spring;
69         Odr_null *summer;
70         Odr_null *autumn;
71     } u;
72 } Z_Season;
73
74 typedef struct Z_PartOfYear
75 {
76     int which;
77 #define Z_PartOfYear_monthAndDay        0
78 #define Z_PartOfYear_julianDay          1
79 #define Z_PartOfYear_weekNumber         2
80 #define Z_PartOfYear_quarter            3
81 #define Z_PartOfYear_season             4
82     union
83     {
84         Z_MonthAndDay *monthAndDay;
85         int *julianDay; 
86         int *weekNumber; 
87         Z_Quarter *quarter;
88         Z_Season *season;
89     } u;
90 } Z_PartOfYear;
91
92 typedef struct Z_Era
93 {
94     int which;
95 #define Z_Era_decade            0
96 #define Z_Era_century           1
97 #define Z_Era_millennium        2
98     union
99     {
100         Odr_null *decade;
101         Odr_null *century;
102         Odr_null *millennium;
103     } u;
104 } Z_Era;
105
106 typedef struct Z_DateFlags
107 {
108     Odr_null *circa;                        /* OPTIONAL */
109     Z_Era *era;                             /* OPTIONAL */
110 } Z_DateFlags;
111
112 typedef struct Z_Date
113 {
114     int *year;
115     Z_PartOfYear *partOfYear;               /* OPTIONAL */
116     Z_DateFlags *flags;                     /* OPTIONAL */
117 } Z_Date;
118
119 typedef struct Z_Zone
120 {
121     int which;
122 #define Z_Zone_local            0
123 #define Z_Zone_utc              1
124 #define Z_Zone_utcOffset        2
125     union
126     {
127         Odr_null *local;
128         Odr_null *utc;
129         int *utcOffset;
130     } u;
131 } Z_Zone;
132
133 typedef struct Z_Time
134 {
135     int *hour;
136     int *minute;                            /* OPTIONAL */
137     int *second;                            /* OPTIONAL */
138     Z_IntUnit *partOfSecond;                /* OPTIONAL */
139     Z_Zone *zone;                           /* OPTIONAL */
140 } Z_Time;
141
142 typedef struct Z_DateTime
143 {
144     Z_Date *z3950Date;                      /* OPTIONAL */
145     Z_Time *z3950Time;                      /* OPTIONAL */
146 } Z_DateTime;
147
148 YAZ_EXPORT int z_DateTime(ODR o, Z_DateTime **p, int opt, const char *name);
149
150 #ifdef __cplusplus
151 }
152 #endif
153
154 #endif