Asterisk.org: Developer Documentation (28 Oct 2009)

Wed Oct 28 15:47:55 2009

## Asterisk developer's documentation

# private.h

Go to the documentation of this file.

    00001 /* $FreeBSD: src/lib/libc/stdtime/private.h,v 1.6.8.1 2000/08/23 00:19:15 jhb Exp $ */
    00002
    00003 #ifndef PRIVATE_H
    00004
    00005 #define PRIVATE_H
    00006 /*
    00007 ** This file is in the public domain, so clarified as of
    00008 ** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov).
    00009 */
    00010
    00011 /* Stuff moved from Makefile.inc to reduce clutter */
    00012 #ifndef __CYGWIN__
    00013 #ifndef TM_GMTOFF
    00014 #define TM_GMTOFF tm_gmtoff
    00015 #define TM_ZONE      tm_zone
    00016 #endif
    00017 #define STD_INSPIRED 1
    00018 #define PCTS      1
    00019 #define HAVE_LONG_DOUBLE 1
    00020 #define HAVE_STRERROR   1
    00021 #define  HAVE_UNISTD_H  1
    00022 #define  LOCALE_HOME _PATH_LOCALE
    00023 #ifdef SOLARIS
    00024 #define TZDIR     "/usr/share/lib/zoneinfo"
    00025 #else
    00026 #define TZDIR     "/usr/share/zoneinfo"
    00027 #endif /* def SOLARIS */
    00028 #endif /* ndef TM_GMTOFF */
    00029
    00030 /*
    00031 ** This header is for use ONLY with the time conversion code.
    00032 ** There is no guarantee that it will remain unchanged,
    00033 ** or that it will remain at all.
    00034 ** Do NOT copy it to any system include directory.
    00035 ** Thank you!
    00036 */
    00037
    00038 /*
    00039 ** ID
    00040 */
    00041
    00042 #ifndef lint
    00043 #ifndef NOID
    00044 /*
    00045 static char privatehid[] = "@(#)private.h 7.43";
    00046 */
    00047 #endif /* !defined NOID */
    00048 #endif /* !defined lint */
    00049
    00050 /*
    00051 ** Defaults for preprocessor symbols.
    00052 ** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
    00053 */
    00054
    00055 #ifndef HAVE_ADJTIME
    00056 #define HAVE_ADJTIME    1
    00057 #endif /* !defined HAVE_ADJTIME */
    00058
    00059 #ifndef HAVE_GETTEXT
    00060 #define HAVE_GETTEXT    0
    00061 #endif /* !defined HAVE_GETTEXT */
    00062
    00063 #ifndef HAVE_SETTIMEOFDAY
    00064 #define HAVE_SETTIMEOFDAY  3
    00065 #endif /* !defined HAVE_SETTIMEOFDAY */
    00066
    00067 #ifndef HAVE_STRERROR
    00068 #define HAVE_STRERROR      0
    00069 #endif /* !defined HAVE_STRERROR */
    00070
    00071 #ifndef HAVE_UNISTD_H
    00072 #define HAVE_UNISTD_H      1
    00073 #endif /* !defined HAVE_UNISTD_H */
    00074
    00075 #ifndef HAVE_UTMPX_H
    00076 #define HAVE_UTMPX_H    0
    00077 #endif /* !defined HAVE_UTMPX_H */
    00078
    00079 #ifndef LOCALE_HOME
    00080 #define LOCALE_HOME     "/usr/lib/locale"
    00081 #endif /* !defined LOCALE_HOME */
    00082
    00083 /*
    00084 ** Nested includes
    00085 */
    00086
    00087 #include "sys/types.h"  /* for time_t */
    00088 #include "stdio.h"
    00089 #include "errno.h"
    00090 #include "string.h"
    00091 #include "limits.h"  /* for CHAR_BIT */
    00092 #include "time.h"
    00093 #include "stdlib.h"
    00094
    00095 #if HAVE_GETTEXT - 0
    00096 #include "libintl.h"
    00097 #endif /* HAVE_GETTEXT - 0 */
    00098
    00099 #if HAVE_UNISTD_H - 0
    00100 #include "unistd.h"  /* for F_OK and R_OK */
    00101 #endif /* HAVE_UNISTD_H - 0 */
    00102
    00103 #if !(HAVE_UNISTD_H - 0)
    00104 #ifndef F_OK
    00105 #define F_OK   0
    00106 #endif /* !defined F_OK */
    00107 #ifndef R_OK
    00108 #define R_OK   4
    00109 #endif /* !defined R_OK */
    00110 #endif /* !(HAVE_UNISTD_H - 0) */
    00111
    00112 /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX.  */
    00113 #define is_digit(c) ((unsigned)(c) - '0' <= 9)
    00114
    00115 /*
    00116 ** Workarounds for compilers/systems.
    00117 */
    00118
    00119 #ifndef P
    00120 #ifdef __STDC__
    00121 #define P(x)   x
    00122 #endif /* defined __STDC__ */
    00123 #ifndef __STDC__
    00124 #define P(x)   ()
    00125 #endif /* !defined __STDC__ */
    00126 #endif /* !defined P */
    00127
    00128 /*
    00129 ** SunOS 4.1.1 headers lack FILENAME_MAX.
    00130 */
    00131
    00132 #ifndef FILENAME_MAX
    00133
    00134 #ifndef MAXPATHLEN
    00135 #ifdef unix
    00136 #include "sys/param.h"
    00137 #endif /* defined unix */
    00138 #endif /* !defined MAXPATHLEN */
    00139
    00140 #ifdef MAXPATHLEN
    00141 #define FILENAME_MAX MAXPATHLEN
    00142 #endif /* defined MAXPATHLEN */
    00143 #ifndef MAXPATHLEN
    00144 #define FILENAME_MAX 1024     /* Pure guesswork */
    00145 #endif /* !defined MAXPATHLEN */
    00146
    00147 #endif /* !defined FILENAME_MAX */
    00148
    00149 /*
    00150 ** Finally, some convenience items.
    00151 */
    00152
    00153 #ifndef TRUE
    00154 #define TRUE   1
    00155 #endif /* !defined TRUE */
    00156
    00157 #ifndef FALSE
    00158 #define FALSE  0
    00159 #endif /* !defined FALSE */
    00160
    00161 #ifndef TYPE_BIT
    00162 #define TYPE_BIT(type)  (sizeof (type) * CHAR_BIT)
    00163 #endif /* !defined TYPE_BIT */
    00164
    00165 #ifndef TYPE_SIGNED
    00166 #define TYPE_SIGNED(type) (((type) -1) < 0)
    00167 #endif /* !defined TYPE_SIGNED */
    00168
    00169 #ifndef INT_STRLEN_MAXIMUM
    00170 /*
    00171 ** 302 / 1000 is log10(2.0) rounded up.
    00172 ** Subtract one for the sign bit if the type is signed;
    00173 ** add one for integer division truncation;
    00174 ** add one more for a minus sign if the type is signed.
    00175 */
    00176 #define INT_STRLEN_MAXIMUM(type) \
    00177     ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
    00178 #endif /* !defined INT_STRLEN_MAXIMUM */
    00179
    00180 /*
    00181 ** INITIALIZE(x)
    00182 */
    00183
    00184 #ifndef GNUC_or_lint
    00185 #ifdef lint
    00186 #define GNUC_or_lint
    00187 #endif /* defined lint */
    00188 #ifndef lint
    00189 #ifdef __GNUC__
    00190 #define GNUC_or_lint
    00191 #endif /* defined __GNUC__ */
    00192 #endif /* !defined lint */
    00193 #endif /* !defined GNUC_or_lint */
    00194
    00195 #ifndef INITIALIZE
    00196 #ifdef GNUC_or_lint
    00197 #define INITIALIZE(x)   ((x) = 0)
    00198 #endif /* defined GNUC_or_lint */
    00199 #ifndef GNUC_or_lint
    00200 #define INITIALIZE(x)
    00201 #endif /* !defined GNUC_or_lint */
    00202 #endif /* !defined INITIALIZE */
    00203
    00204 /*
    00205 ** For the benefit of GNU folk...
    00206 ** `_(MSGID)' uses the current locale's message library string for MSGID.
    00207 ** The default is to use gettext if available, and use MSGID otherwise.
    00208 */
    00209
    00210 #ifndef _
    00211 #if HAVE_GETTEXT - 0
    00212 #define _(msgid) gettext(msgid)
    00213 #else /* !(HAVE_GETTEXT - 0) */
    00214 #define _(msgid) msgid
    00215 #endif /* !(HAVE_GETTEXT - 0) */
    00216 #endif /* !defined _ */
    00217
    00218 #ifndef TZ_DOMAIN
    00219 #define TZ_DOMAIN "tz"
    00220 #endif /* !defined TZ_DOMAIN */
    00221
    00222 /*
    00223 ** UNIX was a registered trademark of UNIX System Laboratories in 1993.
    00224 */
    00225
    00226 #endif /* !defined PRIVATE_H */