~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/timezone/private.h

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef PRIVATE_H
 
2
#define PRIVATE_H
 
3
 
 
4
/*
 
5
 * This file is in the public domain, so clarified as of
 
6
 * 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
 
7
 *
 
8
 * IDENTIFICATION
 
9
 *        $PostgreSQL: pgsql/src/timezone/private.h,v 1.9 2004-08-29 05:07:02 momjian Exp $
 
10
 */
 
11
 
 
12
/*
 
13
 * This header is for use ONLY with the time conversion code.
 
14
 * There is no guarantee that it will remain unchanged,
 
15
 * or that it will remain at all.
 
16
 * Do NOT copy it to any system include directory.
 
17
 * Thank you!
 
18
 */
 
19
 
 
20
#include <limits.h>                             /* for CHAR_BIT */
 
21
#include <sys/wait.h>                   /* for WIFEXITED and WEXITSTATUS */
 
22
#include <unistd.h>                             /* for F_OK and R_OK */
 
23
 
 
24
#include "pgtime.h"
 
25
 
 
26
 
 
27
#ifndef WIFEXITED
 
28
#define WIFEXITED(status)       (((status) & 0xff) == 0)
 
29
#endif   /* !defined WIFEXITED */
 
30
#ifndef WEXITSTATUS
 
31
#define WEXITSTATUS(status) (((status) >> 8) & 0xff)
 
32
#endif   /* !defined WEXITSTATUS */
 
33
 
 
34
/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
 
35
#define is_digit(c) ((unsigned)(c) - '0' <= 9)
 
36
 
 
37
/*
 
38
 * SunOS 4.1.1 headers lack EXIT_SUCCESS.
 
39
 */
 
40
 
 
41
#ifndef EXIT_SUCCESS
 
42
#define EXIT_SUCCESS    0
 
43
#endif   /* !defined EXIT_SUCCESS */
 
44
 
 
45
/*
 
46
 * SunOS 4.1.1 headers lack EXIT_FAILURE.
 
47
 */
 
48
 
 
49
#ifndef EXIT_FAILURE
 
50
#define EXIT_FAILURE    1
 
51
#endif   /* !defined EXIT_FAILURE */
 
52
 
 
53
/*
 
54
 * SunOS 4.1.1 libraries lack remove.
 
55
 */
 
56
 
 
57
#ifndef remove
 
58
extern int      unlink(const char *filename);
 
59
 
 
60
#define remove  unlink
 
61
#endif   /* !defined remove */
 
62
 
 
63
/*
 
64
 * Private function declarations.
 
65
 */
 
66
extern char *icalloc(int nelem, int elsize);
 
67
extern char *icatalloc(char *old, const char *new);
 
68
extern char *icpyalloc(const char *string);
 
69
extern char *imalloc(int n);
 
70
extern void *irealloc(void *pointer, int size);
 
71
extern void icfree(char *pointer);
 
72
extern void ifree(char *pointer);
 
73
extern char *scheck(const char *string, const char *format);
 
74
 
 
75
 
 
76
/*
 
77
 * Finally, some convenience items.
 
78
 */
 
79
 
 
80
#ifndef TRUE
 
81
#define TRUE    1
 
82
#endif   /* !defined TRUE */
 
83
 
 
84
#ifndef FALSE
 
85
#define FALSE   0
 
86
#endif   /* !defined FALSE */
 
87
 
 
88
#ifndef TYPE_BIT
 
89
#define TYPE_BIT(type)  (sizeof (type) * CHAR_BIT)
 
90
#endif   /* !defined TYPE_BIT */
 
91
 
 
92
#ifndef TYPE_SIGNED
 
93
#define TYPE_SIGNED(type) (((type) -1) < 0)
 
94
#endif   /* !defined TYPE_SIGNED */
 
95
 
 
96
#ifndef INT_STRLEN_MAXIMUM
 
97
/*
 
98
 * 302 / 1000 is log10(2.0) rounded up.
 
99
 * Subtract one for the sign bit if the type is signed;
 
100
 * add one for integer division truncation;
 
101
 * add one more for a minus sign if the type is signed.
 
102
 */
 
103
#define INT_STRLEN_MAXIMUM(type) \
 
104
        ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
 
105
#endif   /* !defined INT_STRLEN_MAXIMUM */
 
106
 
 
107
#define _(msgid) (msgid)
 
108
 
 
109
/*
 
110
 * UNIX was a registered trademark of The Open Group in 2003.
 
111
 */
 
112
 
 
113
#endif   /* !defined PRIVATE_H */