Added stubs for AccessCheckByType, AddAuditAccessAce,
[wine] / dlls / oleaut32 / parsedt.h
1 /*
2 PostgreSQL Data Base Management System (formerly known as Postgres, then
3 as Postgres95).
4
5 Copyright (c) 1994-7 Regents of the University of California
6
7 Permission to use, copy, modify, and distribute this software and its
8 documentation for any purpose, without fee, and without a written agreement
9 is hereby granted, provided that the above copyright notice and this
10 paragraph and the following two paragraphs appear in all copies.
11
12 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
13 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
14 LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
15 DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
16 POSSIBILITY OF SUCH DAMAGE.
17
18 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
19 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20 AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
21 ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
22 PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23 */
24 /*-------------------------------------------------------------------------
25  *
26  * dt.h--
27  *        Definitions for the date/time and other date/time support code.
28  *        The support code is shared with other date data types,
29  *         including abstime, reltime, date, and time.
30  *
31  *
32  * Copyright (c) 1994, Regents of the University of California
33  *
34  *-------------------------------------------------------------------------
35  */
36 #ifndef DT_H
37 #define DT_H
38
39 #include <time.h>
40 #include <math.h>
41
42 /* We have to include stdlib.h here because it defines many of these macros
43    on some platforms, and we only want our definitions used if stdlib.h doesn't
44    have its own.
45 */
46
47 #include <stdarg.h>
48 #include <stdlib.h>
49 #include "windef.h"
50 #include "winbase.h"
51 #include "wtypes.h"
52
53 /* ----------------------------------------------------------------
54  *                              Section 1:      bool, true, false, TRUE, FALSE
55  * ----------------------------------------------------------------
56  */
57 /*
58  * bool --
59  *              Boolean value, either true or false.
60  *
61  */
62 #define false   ((char) 0)
63 #define true    ((char) 1)
64 #ifndef __cplusplus
65 #ifndef bool
66 typedef char bool;
67 #endif   /* ndef bool */
68 #endif   /* not C++ */
69 typedef bool *BoolPtr;
70
71 #ifndef TRUE
72 #define TRUE    1
73 #endif   /* TRUE */
74
75 #ifndef FALSE
76 #define FALSE   0
77 #endif   /* FALSE */
78
79
80
81 /* ----------------------------------------------------------------
82  *                              Section 3:      standard system types
83  * ----------------------------------------------------------------
84  */
85
86 /*
87  * intN --
88  *              Signed integer, EXACTLY N BITS IN SIZE,
89  *              used for numerical computations and the
90  *              frontend/backend protocol.
91  */
92 typedef signed char int8;               /* == 8 bits */
93 typedef signed short int16;             /* == 16 bits */
94 typedef signed int int32;               /* == 32 bits */
95
96 /*
97  * uintN --
98  *              Unsigned integer, EXACTLY N BITS IN SIZE,
99  *              used for numerical computations and the
100  *              frontend/backend protocol.
101  */
102 typedef unsigned char uint8;    /* == 8 bits */
103 typedef unsigned short uint16;  /* == 16 bits */
104 typedef unsigned int uint32;    /* == 32 bits */
105
106 /*
107  * floatN --
108  *              Floating point number, AT LEAST N BITS IN SIZE,
109  *              used for numerical computations.
110  *
111  *              Since sizeof(floatN) may be > sizeof(char *), always pass
112  *              floatN by reference.
113  */
114 typedef float float32data;
115 typedef double float64data;
116 typedef float *float32;
117 typedef double *float64;
118
119 /*
120  * boolN --
121  *              Boolean value, AT LEAST N BITS IN SIZE.
122  */
123 typedef uint8 bool8;                    /* >= 8 bits */
124 typedef uint16 bool16;                  /* >= 16 bits */
125 typedef uint32 bool32;                  /* >= 32 bits */
126
127
128 /* Date/Time Configuration
129  *
130  * Constants to pass info from runtime environment:
131  *      USE_POSTGRES_DATES specifies traditional postgres format for output.
132  *      USE_ISO_DATES specifies ISO-compliant format for output.
133  *      USE_SQL_DATES specified Oracle/Ingres-compliant format for output.
134  *      USE_GERMAN_DATES specifies German-style dd.mm/yyyy date format.
135  *
136  * DateStyle specifies preference for date formatting for output.
137  * EuroDates if client prefers dates interpreted and written w/European conventions.
138  *
139  * HasCTZSet if client timezone is specified by client.
140  * CDayLight is the apparent daylight savings time status.
141  * CTimeZone is the timezone offset in seconds.
142  * CTZName is the timezone label.
143  */
144
145 #define USE_POSTGRES_DATES              0
146 #define USE_ISO_DATES                   1
147 #define USE_SQL_DATES                   2
148 #define USE_GERMAN_DATES                3
149
150 extern  int     DateStyle;
151 extern  bool    EuroDates;
152 extern  int     CTimeZone;
153
154 typedef double float8;
155
156 struct varlena
157 {
158         int             vl_len;
159         char            vl_dat[1];
160 };
161
162 typedef struct varlena text;
163
164
165
166 typedef int AbsoluteTime;
167 typedef int RelativeTime;
168
169 /*
170  * Note a leap year is one that is a multiple of 4
171  * but not of a 100.  Except if it is a multiple of
172  * 400 then it is a leap year.
173  */
174 #define isleap(y) (((y % 4) == 0) && (((y % 100) != 0) || ((y % 400) == 0)))
175
176 /*
177  * DateTime represents absolute time.
178  * TimeSpan represents delta time. Keep track of months (and years)
179  *      separately since the elapsed time spanned is unknown until instantiated
180  *      relative to an absolute time.
181  *
182  * Note that Postgres uses "time interval" to mean a bounded interval,
183  *      consisting of a beginning and ending time, not a time span - thomas 97/03/20
184  */
185
186 typedef double DateTime;
187
188 typedef struct
189 {
190         double          time;                   /* all time units other than months and
191                                                                  * years */
192         int             month;                  /* months and years, after time for
193                                                                  * alignment */
194 } TimeSpan;
195
196
197 /* ----------------------------------------------------------------
198  *                              time types + support macros
199  *
200  * String definitions for standard time quantities.
201  *
202  * These strings are the defaults used to form output time strings.
203  * Other alternate forms are hardcoded into token tables in dt.c.
204  * ----------------------------------------------------------------
205  */
206
207 #define DAGO                    "ago"
208 #define DCURRENT                "current"
209 #define EPOCH                   "epoch"
210 #define INVALID                 "invalid"
211 #define EARLY                   "-infinity"
212 #define LATE                    "infinity"
213 #define NOW                             "now"
214 #define TODAY                   "today"
215 #define TOMORROW                "tomorrow"
216 #define YESTERDAY               "yesterday"
217 #define ZULU                    "zulu"
218
219 #define DMICROSEC               "usecond"
220 #define DMILLISEC               "msecond"
221 #define DSECOND                 "second"
222 #define DMINUTE                 "minute"
223 #define DHOUR                   "hour"
224 #define DDAY                    "day"
225 #define DWEEK                   "week"
226 #define DMONTH                  "month"
227 #define DQUARTER                "quarter"
228 #define DYEAR                   "year"
229 #define DDECADE                 "decade"
230 #define DCENTURY                "century"
231 #define DMILLENIUM              "millenium"
232 #define DA_D                    "ad"
233 #define DB_C                    "bc"
234 #define DTIMEZONE               "timezone"
235
236 /*
237  * Fundamental time field definitions for parsing.
238  *
239  *      Meridian:  am, pm, or 24-hour style.
240  *      Millenium: ad, bc
241  */
242
243 #define AM              0
244 #define PM              1
245 #define HR24    2
246
247 #define AD              0
248 #define BC              1
249
250 /*
251  * Fields for time decoding.
252  * Can't have more of these than there are bits in an unsigned int
253  *      since these are turned into bit masks during parsing and decoding.
254  */
255
256 #define RESERV  0
257 #define MONTH   1
258 #define YEAR    2
259 #define DAY             3
260 #define TIMES   4                               /* not used - thomas 1997-07-14 */
261 #define TZ              5
262 #define DTZ             6
263 #define DTZMOD  7
264 #define IGNOREFIELD     8
265 #define AMPM    9
266 #define HOUR    10
267 #define MINUTE  11
268 #define SECOND  12
269 #define DOY             13
270 #define DOW             14
271 #define UNITS   15
272 #define ADBC    16
273 /* these are only for relative dates */
274 #define AGO             17
275 #define ABS_BEFORE              18
276 #define ABS_AFTER               19
277
278 /*
279  * Token field definitions for time parsing and decoding.
280  * These need to fit into the datetkn table type.
281  * At the moment, that means keep them within [-127,127].
282  * These are also used for bit masks in DecodeDateDelta()
283  *      so actually restrict them to within [0,31] for now.
284  * - thomas 97/06/19
285  * Not all of these fields are used for masks in DecodeDateDelta
286  *      so allow some larger than 31. - thomas 1997-11-17
287  */
288
289 #define DTK_NUMBER              0
290 #define DTK_STRING              1
291
292 #define DTK_DATE                2
293 #define DTK_TIME                3
294 #define DTK_TZ                  4
295 #define DTK_AGO                 5
296
297 #define DTK_SPECIAL             6
298 #define DTK_INVALID             7
299 #define DTK_CURRENT             8
300 #define DTK_EARLY               9
301 #define DTK_LATE                10
302 #define DTK_EPOCH               11
303 #define DTK_NOW                 12
304 #define DTK_YESTERDAY   13
305 #define DTK_TODAY               14
306 #define DTK_TOMORROW    15
307 #define DTK_ZULU                16
308
309 #define DTK_DELTA               17
310 #define DTK_SECOND              18
311 #define DTK_MINUTE              19
312 #define DTK_HOUR                20
313 #define DTK_DAY                 21
314 #define DTK_WEEK                22
315 #define DTK_MONTH               23
316 #define DTK_QUARTER             24
317 #define DTK_YEAR                25
318 #define DTK_DECADE              26
319 #define DTK_CENTURY             27
320 #define DTK_MILLENIUM   28
321 #define DTK_MILLISEC    29
322 #define DTK_MICROSEC    30
323
324 #define DTK_DOW                 32
325 #define DTK_DOY                 33
326 #define DTK_TZ_HOUR             34
327 #define DTK_TZ_MINUTE   35
328
329 /*
330  * Bit mask definitions for time parsing.
331  */
332
333 #define DTK_M(t)                (0x01 << (t))
334
335 #define DTK_DATE_M              (DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY))
336 #define DTK_TIME_M              (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_M(SECOND))
337
338 #define MAXDATELEN              47              /* maximum possible length of an input
339                                                                  * date string */
340 #define MAXDATEFIELDS   25              /* maximum possible number of fields in a
341                                                                  * date string */
342 #define TOKMAXLEN               10              /* only this many chars are stored in
343                                                                  * datetktbl */
344
345 /* keep this struct small; it gets used a lot */
346 typedef struct
347 {
348 #if defined(_AIX)
349         char       *token;
350 #else
351         char            token[TOKMAXLEN];
352 #endif   /* _AIX */
353         char            type;
354         char            value;                  /* this may be unsigned, alas */
355 } datetkn;
356
357
358
359 /*
360  * dt.c prototypes
361  */
362
363
364 void j2date(int jd, int *year, int *month, int *day);
365 int     date2j(int year, int month, int day);
366
367 int ParseDateTime(char *timestr, char *lowstr,
368                           char **field, int *ftype, int maxfields, int *numfields);
369 int DecodeDateTime(char **field, int *ftype,
370                          int nf, int *dtype, struct tm * tm, double *fsec, int *tzp);
371
372 int DecodeTimeOnly(char **field, int *ftype, int nf,
373                            int *dtype, struct tm * tm, double *fsec);
374 BOOL DateToTm( DATE dateIn, DWORD dwFlags, struct tm* pTm );
375 #endif   /* DT_H */