Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/common/unicode/putil.h
38827 views
/*1******************************************************************************2*3* Copyright (C) 1997-2014, International Business Machines4* Corporation and others. All Rights Reserved.5*6******************************************************************************7*8* FILE NAME : putil.h9*10* Date Name Description11* 05/14/98 nos Creation (content moved here from utypes.h).12* 06/17/99 erm Added IEEE_75413* 07/22/98 stephen Added IEEEremainder, max, min, trunc14* 08/13/98 stephen Added isNegativeInfinity, isPositiveInfinity15* 08/24/98 stephen Added longBitsFromDouble16* 03/02/99 stephen Removed openFile(). Added AS400 support.17* 04/15/99 stephen Converted to C18* 11/15/99 helena Integrated S/390 changes for IEEE support.19* 01/11/00 helena Added u_getVersion.20******************************************************************************21*/2223#ifndef PUTIL_H24#define PUTIL_H2526#include "unicode/utypes.h"27/**28* \file29* \brief C API: Platform Utilities30*/3132/*==========================================================================*/33/* Platform utilities */34/*==========================================================================*/3536/**37* Platform utilities isolates the platform dependencies of the38* libarary. For each platform which this code is ported to, these39* functions may have to be re-implemented.40*/4142/**43* Return the ICU data directory.44* The data directory is where common format ICU data files (.dat files)45* are loaded from. Note that normal use of the built-in ICU46* facilities does not require loading of an external data file;47* unless you are adding custom data to ICU, the data directory48* does not need to be set.49*50* The data directory is determined as follows:51* If u_setDataDirectory() has been called, that is it, otherwise52* if the ICU_DATA environment variable is set, use that, otherwise53* If a data directory was specifed at ICU build time54* <code>55* \code56* #define ICU_DATA_DIR "path"57* \endcode58* </code> use that,59* otherwise no data directory is available.60*61* @return the data directory, or an empty string ("") if no data directory has62* been specified.63*64* @stable ICU 2.065*/66U_STABLE const char* U_EXPORT2 u_getDataDirectory(void);676869/**70* Set the ICU data directory.71* The data directory is where common format ICU data files (.dat files)72* are loaded from. Note that normal use of the built-in ICU73* facilities does not require loading of an external data file;74* unless you are adding custom data to ICU, the data directory75* does not need to be set.76*77* This function should be called at most once in a process, before the78* first ICU operation (e.g., u_init()) that will require the loading of an79* ICU data file.80* This function is not thread-safe. Use it before calling ICU APIs from81* multiple threads.82*83* @param directory The directory to be set.84*85* @see u_init86* @stable ICU 2.087*/88U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory);8990#ifndef U_HIDE_INTERNAL_API91/**92* Return the time zone files override directory, or an empty string if93* no directory was specified. Certain time zone resources will be preferrentially94* loaded from individual files in this directory.95*96* @return the time zone data override directory.97* @internal98*/99U_INTERNAL const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status);100101/**102* Set the time zone files override directory.103* This function is not thread safe; it must not be called concurrently with104* u_getTimeZoneFilesDirectory() or any other use of ICU time zone functions.105* This function should only be called before using any ICU service that106* will access the time zone data.107* @internal108*/109U_INTERNAL void U_EXPORT2 u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status);110#endif /* U_HIDE_INTERNAL_API */111112113/**114* @{115* Filesystem file and path separator characters.116* Example: '/' and ':' on Unix, '\\' and ';' on Windows.117* @stable ICU 2.0118*/119#if U_PLATFORM_USES_ONLY_WIN32_API120# define U_FILE_SEP_CHAR '\\'121# define U_FILE_ALT_SEP_CHAR '/'122# define U_PATH_SEP_CHAR ';'123# define U_FILE_SEP_STRING "\\"124# define U_FILE_ALT_SEP_STRING "/"125# define U_PATH_SEP_STRING ";"126#else127# define U_FILE_SEP_CHAR '/'128# define U_FILE_ALT_SEP_CHAR '/'129# define U_PATH_SEP_CHAR ':'130# define U_FILE_SEP_STRING "/"131# define U_FILE_ALT_SEP_STRING "/"132# define U_PATH_SEP_STRING ":"133#endif134135/** @} */136137/**138* Convert char characters to UChar characters.139* This utility function is useful only for "invariant characters"140* that are encoded in the platform default encoding.141* They are a small, constant subset of the encoding and include142* just the latin letters, digits, and some punctuation.143* For details, see U_CHARSET_FAMILY.144*145* @param cs Input string, points to <code>length</code>146* character bytes from a subset of the platform encoding.147* @param us Output string, points to memory for <code>length</code>148* Unicode characters.149* @param length The number of characters to convert; this may150* include the terminating <code>NUL</code>.151*152* @see U_CHARSET_FAMILY153* @stable ICU 2.0154*/155U_STABLE void U_EXPORT2156u_charsToUChars(const char *cs, UChar *us, int32_t length);157158/**159* Convert UChar characters to char characters.160* This utility function is useful only for "invariant characters"161* that can be encoded in the platform default encoding.162* They are a small, constant subset of the encoding and include163* just the latin letters, digits, and some punctuation.164* For details, see U_CHARSET_FAMILY.165*166* @param us Input string, points to <code>length</code>167* Unicode characters that can be encoded with the168* codepage-invariant subset of the platform encoding.169* @param cs Output string, points to memory for <code>length</code>170* character bytes.171* @param length The number of characters to convert; this may172* include the terminating <code>NUL</code>.173*174* @see U_CHARSET_FAMILY175* @stable ICU 2.0176*/177U_STABLE void U_EXPORT2178u_UCharsToChars(const UChar *us, char *cs, int32_t length);179180#endif181182183