jpayne@69: // © 2016 and later: Unicode, Inc. and others. jpayne@69: // License & terms of use: http://www.unicode.org/copyright.html jpayne@69: /* jpayne@69: ****************************************************************************** jpayne@69: * jpayne@69: * Copyright (C) 1997-2014, International Business Machines jpayne@69: * Corporation and others. All Rights Reserved. jpayne@69: * jpayne@69: ****************************************************************************** jpayne@69: * jpayne@69: * FILE NAME : putil.h jpayne@69: * jpayne@69: * Date Name Description jpayne@69: * 05/14/98 nos Creation (content moved here from utypes.h). jpayne@69: * 06/17/99 erm Added IEEE_754 jpayne@69: * 07/22/98 stephen Added IEEEremainder, max, min, trunc jpayne@69: * 08/13/98 stephen Added isNegativeInfinity, isPositiveInfinity jpayne@69: * 08/24/98 stephen Added longBitsFromDouble jpayne@69: * 03/02/99 stephen Removed openFile(). Added AS400 support. jpayne@69: * 04/15/99 stephen Converted to C jpayne@69: * 11/15/99 helena Integrated S/390 changes for IEEE support. jpayne@69: * 01/11/00 helena Added u_getVersion. jpayne@69: ****************************************************************************** jpayne@69: */ jpayne@69: jpayne@69: #ifndef PUTIL_H jpayne@69: #define PUTIL_H jpayne@69: jpayne@69: #include "unicode/utypes.h" jpayne@69: /** jpayne@69: * \file jpayne@69: * \brief C API: Platform Utilities jpayne@69: */ jpayne@69: jpayne@69: /*==========================================================================*/ jpayne@69: /* Platform utilities */ jpayne@69: /*==========================================================================*/ jpayne@69: jpayne@69: /** jpayne@69: * Platform utilities isolates the platform dependencies of the jpayne@69: * library. For each platform which this code is ported to, these jpayne@69: * functions may have to be re-implemented. jpayne@69: */ jpayne@69: jpayne@69: /** jpayne@69: * Return the ICU data directory. jpayne@69: * The data directory is where common format ICU data files (.dat files) jpayne@69: * are loaded from. Note that normal use of the built-in ICU jpayne@69: * facilities does not require loading of an external data file; jpayne@69: * unless you are adding custom data to ICU, the data directory jpayne@69: * does not need to be set. jpayne@69: * jpayne@69: * The data directory is determined as follows: jpayne@69: * If u_setDataDirectory() has been called, that is it, otherwise jpayne@69: * if the ICU_DATA environment variable is set, use that, otherwise jpayne@69: * If a data directory was specified at ICU build time jpayne@69: * jpayne@69: * \code jpayne@69: * #define ICU_DATA_DIR "path" jpayne@69: * \endcode jpayne@69: * use that, jpayne@69: * otherwise no data directory is available. jpayne@69: * jpayne@69: * @return the data directory, or an empty string ("") if no data directory has jpayne@69: * been specified. jpayne@69: * jpayne@69: * @stable ICU 2.0 jpayne@69: */ jpayne@69: U_STABLE const char* U_EXPORT2 u_getDataDirectory(void); jpayne@69: jpayne@69: jpayne@69: /** jpayne@69: * Set the ICU data directory. jpayne@69: * The data directory is where common format ICU data files (.dat files) jpayne@69: * are loaded from. Note that normal use of the built-in ICU jpayne@69: * facilities does not require loading of an external data file; jpayne@69: * unless you are adding custom data to ICU, the data directory jpayne@69: * does not need to be set. jpayne@69: * jpayne@69: * This function should be called at most once in a process, before the jpayne@69: * first ICU operation (e.g., u_init()) that will require the loading of an jpayne@69: * ICU data file. jpayne@69: * This function is not thread-safe. Use it before calling ICU APIs from jpayne@69: * multiple threads. jpayne@69: * jpayne@69: * @param directory The directory to be set. jpayne@69: * jpayne@69: * @see u_init jpayne@69: * @stable ICU 2.0 jpayne@69: */ jpayne@69: U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory); jpayne@69: jpayne@69: #ifndef U_HIDE_INTERNAL_API jpayne@69: /** jpayne@69: * Return the time zone files override directory, or an empty string if jpayne@69: * no directory was specified. Certain time zone resources will be preferentially jpayne@69: * loaded from individual files in this directory. jpayne@69: * jpayne@69: * @return the time zone data override directory. jpayne@69: * @internal jpayne@69: */ jpayne@69: U_INTERNAL const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status); jpayne@69: jpayne@69: /** jpayne@69: * Set the time zone files override directory. jpayne@69: * This function is not thread safe; it must not be called concurrently with jpayne@69: * u_getTimeZoneFilesDirectory() or any other use of ICU time zone functions. jpayne@69: * This function should only be called before using any ICU service that jpayne@69: * will access the time zone data. jpayne@69: * @internal jpayne@69: */ jpayne@69: U_INTERNAL void U_EXPORT2 u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status); jpayne@69: #endif /* U_HIDE_INTERNAL_API */ jpayne@69: jpayne@69: jpayne@69: /** jpayne@69: * @{ jpayne@69: * Filesystem file and path separator characters. jpayne@69: * Example: '/' and ':' on Unix, '\\' and ';' on Windows. jpayne@69: * @stable ICU 2.0 jpayne@69: */ jpayne@69: #if U_PLATFORM_USES_ONLY_WIN32_API jpayne@69: # define U_FILE_SEP_CHAR '\\' jpayne@69: # define U_FILE_ALT_SEP_CHAR '/' jpayne@69: # define U_PATH_SEP_CHAR ';' jpayne@69: # define U_FILE_SEP_STRING "\\" jpayne@69: # define U_FILE_ALT_SEP_STRING "/" jpayne@69: # define U_PATH_SEP_STRING ";" jpayne@69: #else jpayne@69: # define U_FILE_SEP_CHAR '/' jpayne@69: # define U_FILE_ALT_SEP_CHAR '/' jpayne@69: # define U_PATH_SEP_CHAR ':' jpayne@69: # define U_FILE_SEP_STRING "/" jpayne@69: # define U_FILE_ALT_SEP_STRING "/" jpayne@69: # define U_PATH_SEP_STRING ":" jpayne@69: #endif jpayne@69: jpayne@69: /** @} */ jpayne@69: jpayne@69: /** jpayne@69: * Convert char characters to UChar characters. jpayne@69: * This utility function is useful only for "invariant characters" jpayne@69: * that are encoded in the platform default encoding. jpayne@69: * They are a small, constant subset of the encoding and include jpayne@69: * just the latin letters, digits, and some punctuation. jpayne@69: * For details, see U_CHARSET_FAMILY. jpayne@69: * jpayne@69: * @param cs Input string, points to length jpayne@69: * character bytes from a subset of the platform encoding. jpayne@69: * @param us Output string, points to memory for length jpayne@69: * Unicode characters. jpayne@69: * @param length The number of characters to convert; this may jpayne@69: * include the terminating NUL. jpayne@69: * jpayne@69: * @see U_CHARSET_FAMILY jpayne@69: * @stable ICU 2.0 jpayne@69: */ jpayne@69: U_STABLE void U_EXPORT2 jpayne@69: u_charsToUChars(const char *cs, UChar *us, int32_t length); jpayne@69: jpayne@69: /** jpayne@69: * Convert UChar characters to char characters. jpayne@69: * This utility function is useful only for "invariant characters" jpayne@69: * that can be encoded in the platform default encoding. jpayne@69: * They are a small, constant subset of the encoding and include jpayne@69: * just the latin letters, digits, and some punctuation. jpayne@69: * For details, see U_CHARSET_FAMILY. jpayne@69: * jpayne@69: * @param us Input string, points to length jpayne@69: * Unicode characters that can be encoded with the jpayne@69: * codepage-invariant subset of the platform encoding. jpayne@69: * @param cs Output string, points to memory for length jpayne@69: * character bytes. jpayne@69: * @param length The number of characters to convert; this may jpayne@69: * include the terminating NUL. jpayne@69: * jpayne@69: * @see U_CHARSET_FAMILY jpayne@69: * @stable ICU 2.0 jpayne@69: */ jpayne@69: U_STABLE void U_EXPORT2 jpayne@69: u_UCharsToChars(const UChar *us, char *cs, int32_t length); jpayne@69: jpayne@69: #endif