ICU-3854 Merge pos400.h with platform.h so that people can properly use configure.

X-SVN-Rev: 15916
This commit is contained in:
George Rhoten 2004-06-18 18:23:05 +00:00
parent 85c501e808
commit 809cedb225
7 changed files with 283 additions and 506 deletions

View file

@ -36,10 +36,6 @@
******************************************************************************
*/
#ifdef _AIX
# include<sys/types.h>
#endif
#ifndef PTX
/* Define _XOPEN_SOURCE for Solaris and friends. */
@ -70,15 +66,6 @@
#include "ucln_cmn.h"
#include "udataswp.h"
/* Include standard headers. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <locale.h>
#include <time.h>
#include <float.h>
/* include system headers */
#ifdef WIN32
# define WIN32_LEAN_AND_MEAN
@ -88,6 +75,9 @@
# define NOIME
# define NOMCX
# include <windows.h>
#elif defined(U_CYGWIN) && defined(__STRICT_ANSI__)
/* tzset isn't defined in strict ANSI on Cygwin. */
# undef __STRICT_ANSI__
#elif defined(OS2)
# define INCL_DOSMISC
# define INCL_DOSERRORS
@ -108,18 +98,8 @@
#elif defined(OS390)
#include "unicode/ucnv.h" /* Needed for UCNV_SWAP_LFNL_OPTION_STRING */
#elif defined(U_AIX)
/*
# include <sys/ldr.h>
*/
#elif defined(U_SOLARIS) || defined(U_LINUX)
/*
# include <dlfcn.h>
# include <link.h>
*/
#elif defined(U_HPUX)
/*
# include <dl.h>
*/
#elif defined(U_DARWIN)
#include <sys/file.h>
#include <sys/param.h>
@ -127,6 +107,25 @@
#include <sys/neutrino.h>
#endif
/* Include standard headers. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <locale.h>
#include <float.h>
#include <time.h>
/*
* Only include langinfo.h if we have a way to get the codeset. If we later
* depend on more feature, we can test on U_HAVE_NL_LANGINFO.
*
*/
#if U_HAVE_NL_LANGINFO_CODESET
#include <langinfo.h>
#endif
/* Define the extension for data files, again... */
#define DATA_TYPE "dat"
@ -186,16 +185,6 @@ static double * const fgInf = &gInf;
# define U_POSIX_LOCALE 1
#endif
/*
* Only include langinfo.h if we have a way to get the codeset. If we later
* depend on more feature, we can test on U_HAVE_NL_LANGINFO.
*
*/
#if U_HAVE_NL_LANGINFO_CODESET
#include <langinfo.h>
#endif
/* Utilities to get the bits from a double */
static char*
u_topNBytesOfDouble(double* d, int n)
@ -719,7 +708,67 @@ uprv_digitsAfterDecimal(double x)
Based on original code by Carl Brown <cbrown@xnetinc.com>
*/
static LONG openTZRegKey(HKEY* hkey, const char* winid, int winType);
/**
* Auxiliary Windows time zone function. Attempts to open the given
* Windows time zone ID as a registry key. Returns ERROR_SUCCESS if
* successful. Caller must close the registry key. Handles
* variations in the resource layout in different flavors of Windows.
*
* @param hkey output parameter to receive opened registry key
* @param winid Windows zone ID, e.g., "Pacific", without the
* " Standard Time" suffix (if any). Special case "Mexico Standard Time 2"
* allowed.
* @param winType Windows flavor (WIN_9X_ME_TYPE, etc.)
* @return ERROR_SUCCESS upon success
*/
static LONG openTZRegKey(HKEY *hkey, const char* winid, int winType) {
LONG result;
char subKeyName[96];
char* name;
int i;
uprv_strcpy(subKeyName, TZ_REGKEY[(winType == WIN_9X_ME_TYPE) ? 0 : 1]);
name = &subKeyName[strlen(subKeyName)];
uprv_strcat(subKeyName, winid);
if (winType != WIN_9X_ME_TYPE) {
/* Don't modify "Mexico Standard Time 2", which does not occur
on WIN_9X_ME_TYPE. Also, if the type is WIN_NT_TYPE, then
in practice this means the GMT key is not followed by
" Standard Time", so don't append in that case. */
int isMexico2 = (winid[uprv_strlen(winid)- 1] == '2');
if (!isMexico2 &&
!(winType == WIN_NT_TYPE && uprv_strcmp(winid, "GMT") == 0)) {
uprv_strcat(subKeyName, STANDARD_TIME_REGKEY);
}
}
result = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
subKeyName,
0,
KEY_QUERY_VALUE,
hkey);
if (result != ERROR_SUCCESS) {
/* If the primary lookup fails, try to remap the Windows zone
ID, according to the remapping table. */
for (i=0; ZONE_REMAP[i].winid; ++i) {
if (uprv_strcmp(winid, ZONE_REMAP[i].winid) == 0) {
uprv_strcpy(name, ZONE_REMAP[i].altwinid + 1);
if (*(ZONE_REMAP[i].altwinid) == '+' &&
winType != WIN_9X_ME_TYPE) {
uprv_strcat(subKeyName, STANDARD_TIME_REGKEY);
}
result = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
subKeyName,
0,
KEY_QUERY_VALUE,
hkey);
break;
}
}
}
return result;
}
/**
* Layout of the binary registry data under the "TZI" key.
@ -1086,68 +1135,6 @@ static const char* detectWindowsTimeZone() {
return ZONE_MAP[firstMatch].icuid;
}
/**
* Auxiliary Windows time zone function. Attempts to open the given
* Windows time zone ID as a registry key. Returns ERROR_SUCCESS if
* successful. Caller must close the registry key. Handles
* variations in the resource layout in different flavors of Windows.
*
* @param hkey output parameter to receive opened registry key
* @param winid Windows zone ID, e.g., "Pacific", without the
* " Standard Time" suffix (if any). Special case "Mexico Standard Time 2"
* allowed.
* @param winType Windows flavor (WIN_9X_ME_TYPE, etc.)
* @return ERROR_SUCCESS upon success
*/
static LONG openTZRegKey(HKEY *hkey, const char* winid, int winType) {
LONG result;
char subKeyName[96];
char* name;
int i;
uprv_strcpy(subKeyName, TZ_REGKEY[(winType == WIN_9X_ME_TYPE) ? 0 : 1]);
name = &subKeyName[strlen(subKeyName)];
uprv_strcat(subKeyName, winid);
if (winType != WIN_9X_ME_TYPE) {
/* Don't modify "Mexico Standard Time 2", which does not occur
on WIN_9X_ME_TYPE. Also, if the type is WIN_NT_TYPE, then
in practice this means the GMT key is not followed by
" Standard Time", so don't append in that case. */
int isMexico2 = (winid[uprv_strlen(winid)- 1] == '2');
if (!isMexico2 &&
!(winType == WIN_NT_TYPE && uprv_strcmp(winid, "GMT") == 0)) {
uprv_strcat(subKeyName, STANDARD_TIME_REGKEY);
}
}
result = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
subKeyName,
0,
KEY_QUERY_VALUE,
hkey);
if (result != ERROR_SUCCESS) {
/* If the primary lookup fails, try to remap the Windows zone
ID, according to the remapping table. */
for (i=0; ZONE_REMAP[i].winid; ++i) {
if (uprv_strcmp(winid, ZONE_REMAP[i].winid) == 0) {
uprv_strcpy(name, ZONE_REMAP[i].altwinid + 1);
if (*(ZONE_REMAP[i].altwinid) == '+' &&
winType != WIN_9X_ME_TYPE) {
uprv_strcat(subKeyName, STANDARD_TIME_REGKEY);
}
result = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
subKeyName,
0,
KEY_QUERY_VALUE,
hkey);
break;
}
}
}
return result;
}
#endif /*WIN32*/
/* Generic time zone layer -------------------------------------------------- */
@ -1166,7 +1153,7 @@ uprv_tzset()
U_CAPI int32_t U_EXPORT2
uprv_timezone()
{
#if U_HAVE_TIMEZONE
#ifdef U_TIMEZONE
return U_TIMEZONE;
#else
time_t t, t1, t2;
@ -1192,21 +1179,18 @@ uprv_timezone()
/* Note that U_TZNAME does *not* have to be tzname, but if it is,
some platforms need to have it declared here. */
#if defined(U_IRIX) || defined(U_DARWIN) /* For SGI or Mac OS X. */
extern char *tzname[]; /* RS6000 and others reject char **tzname. */
#elif defined(U_CYGWIN)
extern U_IMPORT char *_tzname[2];
#if defined(U_TZNAME) && (defined(U_IRIX) || defined(U_DARWIN) || defined(U_CYGWIN))
/* RS6000 and others reject char **tzname. */
extern U_IMPORT char *U_TZNAME[];
#endif
#if defined(U_DARWIN) /* For Mac OS X */
#define TZZONELINK "/etc/localtime"
#define TZZONEINFO "/usr/share/zoneinfo/"
#if defined(U_DARWIN) /* For Mac OS X */
#define TZZONELINK "/etc/localtime"
#define TZZONEINFO "/usr/share/zoneinfo/"
static char *gTimeZoneBuffer = NULL; /* Heap allocated */
#endif
#include <stdio.h>
U_CAPI char* U_EXPORT2
U_CAPI const char* U_EXPORT2
uprv_tzname(int n)
{
#ifdef WIN32
@ -1223,20 +1207,20 @@ uprv_tzname(int n)
tzenv = getenv("TZFILE");
if (tzenv != NULL) {
return tzenv;
return tzenv;
}
#if 0
/* TZ is often set to "PST8PDT" or similar, so we cannot use it. Alan */
tzenv = getenv("TZ");
if (tzenv != NULL) {
return tzenv;
return tzenv;
}
#endif
/* Caller must handle threading issues */
if (gTimeZoneBuffer == NULL) {
gTimeZoneBuffer = (char *) uprv_malloc(MAXPATHLEN + 2);
gTimeZoneBuffer = (char *) uprv_malloc(MAXPATHLEN + 2);
ret = readlink(TZZONELINK, gTimeZoneBuffer, MAXPATHLEN + 2);
if (0 < ret) {

View file

@ -219,7 +219,7 @@ typedef unsigned int uint32_t;
/* Character data types */
/*===========================================================================*/
#ifdef OS390
#if defined(OS390) || defined(OS400)
# define U_CHARSET_FAMILY 1
#endif
@ -240,12 +240,15 @@ typedef unsigned int uint32_t;
#define U_HAVE_NL_LANGINFO_CODESET @U_HAVE_NL_LANGINFO_CODESET@
#define U_NL_LANGINFO_CODESET @U_NL_LANGINFO_CODESET@
#if @U_HAVE_TZSET@
#define U_TZSET @U_TZSET@
#define U_HAVE_TIMEZONE @U_HAVE_TIMEZONE@
#if U_HAVE_TIMEZONE
# define U_TIMEZONE @U_TIMEZONE@
#endif
#if @U_HAVE_TIMEZONE@
#define U_TIMEZONE @U_TIMEZONE@
#endif
#if @U_HAVE_TZNAME@
#define U_TZNAME @U_TZNAME@
#endif
#define U_HAVE_MMAP @HAVE_MMAP@
#define U_HAVE_POPEN @U_HAVE_POPEN@

View file

@ -1,177 +0,0 @@
/*
*******************************************************************************
*
* Copyright (C) 1997-2003, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
*
* FILE NAME : pos400.h
*
* Date Name Description
* 05/13/98 nos Creation (content moved here from ptypes.h).
* 03/02/99 stephen Added AS400 support.
* 03/30/99 stephen Added Linux support.
* 04/13/99 stephen Reworked for autoconf.
* 09/21/99 barry Created new for OS/400 platform.
*******************************************************************************
*/
/* Define the platform we're on. */
#ifndef OS400
#define OS400
#endif
/* Define whether inttypes.h is available */
#define U_HAVE_INTTYPES_H 0
/*
* Define what support for C++ streams is available.
* If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available
* (1997711 is the date the ISO/IEC C++ FDIS was published), and then
* one should qualify streams using the std namespace in ICU header
* files.
* If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is
* available instead (198506 is the date when Stroustrup published
* "An Extensible I/O Facility for C++" at the summer USENIX conference).
* If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and
* support for them will be silently suppressed in ICU.
*
*/
#ifndef U_IOSTREAM_SOURCE
#define U_IOSTREAM_SOURCE 198506
#endif
/* Determines whether specific types are available */
#define U_HAVE_INT8_T 0
#define U_HAVE_UINT8_T 0
#define U_HAVE_INT16_T 0
#define U_HAVE_UINT16_T 0
#define U_HAVE_INT32_T 0
#define U_HAVE_UINT32_T 0
#define U_HAVE_INT64_T 0
#define U_HAVE_UINT64_T 0
/* Define whether namespace is supported */
#define U_HAVE_NAMESPACE 0
/* Determines the endianness of the platform */
#define U_IS_BIG_ENDIAN 1
/* 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */
#define ICU_USE_THREADS 1
/* Determine whether to disable renaming or not. This overrides the
setting in umachine.h which is for all platforms. */
#ifndef U_OVERRIDE_CXX_ALLOCATION
#define U_OVERRIDE_CXX_ALLOCATION 1
#endif
/* Determine whether to enable tracing. */
#ifndef U_ENABLE_TRACING
#define U_ENABLE_TRACING 1
#endif
/*===========================================================================*/
/* Generic data types */
/*===========================================================================*/
/* If your platform does not have the <inttypes.h> header, you may
need to edit the typedefs below. */
#if U_HAVE_INTTYPES_H
#include <inttypes.h>
#else
#if ! U_HAVE_INT8_T
typedef signed char int8_t;
#endif
#if ! U_HAVE_UINT8_T
typedef unsigned char uint8_t;
#endif
#if ! U_HAVE_INT16_T
typedef signed short int16_t;
#endif
#if ! U_HAVE_UINT16_T
typedef unsigned short uint16_t;
#endif
#if ! U_HAVE_INT32_T
typedef signed long int32_t;
#endif
#if ! U_HAVE_UINT32_T
typedef unsigned long uint32_t;
#endif
#if ! U_HAVE_INT64_T
typedef signed long long int64_t;
#endif
#if ! U_HAVE_UINT64_T
typedef unsigned long long uint64_t;
#endif
#endif
/*===========================================================================*/
/* Character data types */
/*===========================================================================*/
#define U_CHARSET_FAMILY 1
/*===========================================================================*/
/* Information about wchar support */
/*===========================================================================*/
#define U_HAVE_WCHAR_H 1
#define U_SIZEOF_WCHAR_T 2
#define U_HAVE_WCSCPY 1
/*===========================================================================*/
/* Information about POSIX support */
/*===========================================================================*/
#define U_HAVE_NL_LANGINFO 0
#define U_HAVE_NL_LANGINFO_CODESET 0
#define U_NL_LANGINFO_CODESET
/* These cannot be defined for this platform
#define U_TZSET
#define U_HAVE_TIMEZONE 0
#if U_HAVE_TIMEZONE
# define U_TIMEZONE
#endif
#define U_TZNAME
*/
#define U_HAVE_MMAP 1
/*===========================================================================*/
/* Symbol import-export control */
/*===========================================================================*/
#define U_EXPORT
#define U_EXPORT2
#define U_IMPORT
/*===========================================================================*/
/* Code alignment and C function inlining */
/*===========================================================================*/
#ifndef U_INLINE
#define U_INLINE
#endif
#define U_ALIGN_CODE(n)
/*===========================================================================*/
/* Programs used by ICU code */
/*===========================================================================*/
#define U_MAKE "gmake"

View file

@ -235,7 +235,7 @@ U_STABLE int32_t U_EXPORT2 uprv_timezone(void);
* tzname(1) is an empty string.
* @internal
*/
U_INTERNAL char* U_EXPORT2 uprv_tzname(int n);
U_INTERNAL const char* U_EXPORT2 uprv_tzname(int n);
/**
* Get UTC (GMT) time measured in seconds since 0:00 on 1/1/70.

View file

@ -43,8 +43,6 @@
#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
# include "unicode/pwin32.h"
#elif defined(__OS400__)
# include "unicode/pos400.h"
#elif defined(__MWERKS__)
# include "unicode/pmacos.h"
#else

382
icu4c/source/configure vendored

File diff suppressed because it is too large Load diff

View file

@ -511,17 +511,23 @@ fi
AC_SUBST(U_HAVE_POPEN)
AC_CHECK_FUNC(tzset)
U_HAVE_TZSET=0
if test x$ac_cv_func_tzset = xyes
then
U_TZSET=tzset
U_HAVE_TZSET=1
else
AC_CHECK_FUNC(_tzset)
if test x$ac_cv_func__tzset = xyes
then
U_TZSET=_tzset
U_TZSET=_tzset
U_HAVE_TZSET=1
fi
fi
AC_SUBST(U_HAVE_TZSET)
AC_SUBST(U_TZSET)
U_HAVE_TZNAME=0
AC_CACHE_CHECK(for tzname,ac_cv_var_tzname,
[AC_TRY_LINK(
changequote(<<, >>)dnl
@ -536,6 +542,7 @@ changequote([, ])dnl
[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
if test $ac_cv_var_tzname = yes; then
U_TZNAME=tzname
U_HAVE_TZNAME=1
else
AC_CACHE_CHECK(for _tzname,ac_cv_var__tzname,
[AC_TRY_LINK(
@ -547,8 +554,10 @@ else
[atoi(*_tzname);], ac_cv_var__tzname=yes, ac_cv_var__tzname=no)])
if test $ac_cv_var__tzname = yes; then
U_TZNAME=_tzname
U_HAVE_TZNAME=1
fi
fi
AC_SUBST(U_HAVE_TZNAME)
AC_SUBST(U_TZNAME)
AC_CACHE_CHECK(for timezone,ac_cv_var_timezone,