intl/icu/source/common/unicode/putil.h

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 /*
michael@0 2 ******************************************************************************
michael@0 3 *
michael@0 4 * Copyright (C) 1997-2011, International Business Machines
michael@0 5 * Corporation and others. All Rights Reserved.
michael@0 6 *
michael@0 7 ******************************************************************************
michael@0 8 *
michael@0 9 * FILE NAME : putil.h
michael@0 10 *
michael@0 11 * Date Name Description
michael@0 12 * 05/14/98 nos Creation (content moved here from utypes.h).
michael@0 13 * 06/17/99 erm Added IEEE_754
michael@0 14 * 07/22/98 stephen Added IEEEremainder, max, min, trunc
michael@0 15 * 08/13/98 stephen Added isNegativeInfinity, isPositiveInfinity
michael@0 16 * 08/24/98 stephen Added longBitsFromDouble
michael@0 17 * 03/02/99 stephen Removed openFile(). Added AS400 support.
michael@0 18 * 04/15/99 stephen Converted to C
michael@0 19 * 11/15/99 helena Integrated S/390 changes for IEEE support.
michael@0 20 * 01/11/00 helena Added u_getVersion.
michael@0 21 ******************************************************************************
michael@0 22 */
michael@0 23
michael@0 24 #ifndef PUTIL_H
michael@0 25 #define PUTIL_H
michael@0 26
michael@0 27 #include "unicode/utypes.h"
michael@0 28 /**
michael@0 29 * \file
michael@0 30 * \brief C API: Platform Utilities
michael@0 31 */
michael@0 32
michael@0 33 /*==========================================================================*/
michael@0 34 /* Platform utilities */
michael@0 35 /*==========================================================================*/
michael@0 36
michael@0 37 /**
michael@0 38 * Platform utilities isolates the platform dependencies of the
michael@0 39 * libarary. For each platform which this code is ported to, these
michael@0 40 * functions may have to be re-implemented.
michael@0 41 */
michael@0 42
michael@0 43 /**
michael@0 44 * Return the ICU data directory.
michael@0 45 * The data directory is where common format ICU data files (.dat files)
michael@0 46 * are loaded from. Note that normal use of the built-in ICU
michael@0 47 * facilities does not require loading of an external data file;
michael@0 48 * unless you are adding custom data to ICU, the data directory
michael@0 49 * does not need to be set.
michael@0 50 *
michael@0 51 * The data directory is determined as follows:
michael@0 52 * If u_setDataDirectory() has been called, that is it, otherwise
michael@0 53 * if the ICU_DATA environment variable is set, use that, otherwise
michael@0 54 * If a data directory was specifed at ICU build time
michael@0 55 * <code>
michael@0 56 * \code
michael@0 57 * #define ICU_DATA_DIR "path"
michael@0 58 * \endcode
michael@0 59 * </code> use that,
michael@0 60 * otherwise no data directory is available.
michael@0 61 *
michael@0 62 * @return the data directory, or an empty string ("") if no data directory has
michael@0 63 * been specified.
michael@0 64 *
michael@0 65 * @stable ICU 2.0
michael@0 66 */
michael@0 67 U_STABLE const char* U_EXPORT2 u_getDataDirectory(void);
michael@0 68
michael@0 69 /**
michael@0 70 * Set the ICU data directory.
michael@0 71 * The data directory is where common format ICU data files (.dat files)
michael@0 72 * are loaded from. Note that normal use of the built-in ICU
michael@0 73 * facilities does not require loading of an external data file;
michael@0 74 * unless you are adding custom data to ICU, the data directory
michael@0 75 * does not need to be set.
michael@0 76 *
michael@0 77 * This function should be called at most once in a process, before the
michael@0 78 * first ICU operation (e.g., u_init()) that will require the loading of an
michael@0 79 * ICU data file.
michael@0 80 * This function is not thread-safe. Use it before calling ICU APIs from
michael@0 81 * multiple threads.
michael@0 82 *
michael@0 83 * @param directory The directory to be set.
michael@0 84 *
michael@0 85 * @see u_init
michael@0 86 * @stable ICU 2.0
michael@0 87 */
michael@0 88 U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory);
michael@0 89
michael@0 90 /**
michael@0 91 * @{
michael@0 92 * Filesystem file and path separator characters.
michael@0 93 * Example: '/' and ':' on Unix, '\\' and ';' on Windows.
michael@0 94 * @stable ICU 2.0
michael@0 95 */
michael@0 96 #if U_PLATFORM == U_PF_CLASSIC_MACOS
michael@0 97 # define U_FILE_SEP_CHAR ':'
michael@0 98 # define U_FILE_ALT_SEP_CHAR ':'
michael@0 99 # define U_PATH_SEP_CHAR ';'
michael@0 100 # define U_FILE_SEP_STRING ":"
michael@0 101 # define U_FILE_ALT_SEP_STRING ":"
michael@0 102 # define U_PATH_SEP_STRING ";"
michael@0 103 #elif U_PLATFORM_USES_ONLY_WIN32_API
michael@0 104 # define U_FILE_SEP_CHAR '\\'
michael@0 105 # define U_FILE_ALT_SEP_CHAR '/'
michael@0 106 # define U_PATH_SEP_CHAR ';'
michael@0 107 # define U_FILE_SEP_STRING "\\"
michael@0 108 # define U_FILE_ALT_SEP_STRING "/"
michael@0 109 # define U_PATH_SEP_STRING ";"
michael@0 110 #else
michael@0 111 # define U_FILE_SEP_CHAR '/'
michael@0 112 # define U_FILE_ALT_SEP_CHAR '/'
michael@0 113 # define U_PATH_SEP_CHAR ':'
michael@0 114 # define U_FILE_SEP_STRING "/"
michael@0 115 # define U_FILE_ALT_SEP_STRING "/"
michael@0 116 # define U_PATH_SEP_STRING ":"
michael@0 117 #endif
michael@0 118
michael@0 119 /** @} */
michael@0 120
michael@0 121 /**
michael@0 122 * Convert char characters to UChar characters.
michael@0 123 * This utility function is useful only for "invariant characters"
michael@0 124 * that are encoded in the platform default encoding.
michael@0 125 * They are a small, constant subset of the encoding and include
michael@0 126 * just the latin letters, digits, and some punctuation.
michael@0 127 * For details, see U_CHARSET_FAMILY.
michael@0 128 *
michael@0 129 * @param cs Input string, points to <code>length</code>
michael@0 130 * character bytes from a subset of the platform encoding.
michael@0 131 * @param us Output string, points to memory for <code>length</code>
michael@0 132 * Unicode characters.
michael@0 133 * @param length The number of characters to convert; this may
michael@0 134 * include the terminating <code>NUL</code>.
michael@0 135 *
michael@0 136 * @see U_CHARSET_FAMILY
michael@0 137 * @stable ICU 2.0
michael@0 138 */
michael@0 139 U_STABLE void U_EXPORT2
michael@0 140 u_charsToUChars(const char *cs, UChar *us, int32_t length);
michael@0 141
michael@0 142 /**
michael@0 143 * Convert UChar characters to char characters.
michael@0 144 * This utility function is useful only for "invariant characters"
michael@0 145 * that can be encoded in the platform default encoding.
michael@0 146 * They are a small, constant subset of the encoding and include
michael@0 147 * just the latin letters, digits, and some punctuation.
michael@0 148 * For details, see U_CHARSET_FAMILY.
michael@0 149 *
michael@0 150 * @param us Input string, points to <code>length</code>
michael@0 151 * Unicode characters that can be encoded with the
michael@0 152 * codepage-invariant subset of the platform encoding.
michael@0 153 * @param cs Output string, points to memory for <code>length</code>
michael@0 154 * character bytes.
michael@0 155 * @param length The number of characters to convert; this may
michael@0 156 * include the terminating <code>NUL</code>.
michael@0 157 *
michael@0 158 * @see U_CHARSET_FAMILY
michael@0 159 * @stable ICU 2.0
michael@0 160 */
michael@0 161 U_STABLE void U_EXPORT2
michael@0 162 u_UCharsToChars(const UChar *us, char *cs, int32_t length);
michael@0 163
michael@0 164 #endif

mercurial