annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/unicode/putil.h @ 69:33d812a61356

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