sl@0: /*
sl@0: ******************************************************************************
sl@0: *
sl@0: * Copyright (C) 1997-2005, International Business Machines
sl@0: * Corporation and others. All Rights Reserved.
sl@0: *
sl@0: ******************************************************************************
sl@0: *
sl@0: * FILE NAME : putil.h
sl@0: *
sl@0: * Date Name Description
sl@0: * 05/14/98 nos Creation (content moved here from utypes.h).
sl@0: * 06/17/99 erm Added IEEE_754
sl@0: * 07/22/98 stephen Added IEEEremainder, max, min, trunc
sl@0: * 08/13/98 stephen Added isNegativeInfinity, isPositiveInfinity
sl@0: * 08/24/98 stephen Added longBitsFromDouble
sl@0: * 03/02/99 stephen Removed openFile(). Added AS400 support.
sl@0: * 04/15/99 stephen Converted to C
sl@0: * 11/15/99 helena Integrated S/390 changes for IEEE support.
sl@0: * 01/11/00 helena Added u_getVersion.
sl@0: ******************************************************************************
sl@0: */
sl@0:
sl@0: #ifndef PUTIL_H
sl@0: #define PUTIL_H
sl@0:
sl@0: #include "unicode/utypes.h"
sl@0: /**
sl@0: * \file
sl@0: * \brief C API: Platform Utilities
sl@0: */
sl@0:
sl@0: /* Define this to 1 if your platform supports IEEE 754 floating point,
sl@0: to 0 if it does not. */
sl@0: #ifndef IEEE_754
sl@0: # define IEEE_754 1
sl@0: #endif
sl@0:
sl@0: /*==========================================================================*/
sl@0: /* Platform utilities */
sl@0: /*==========================================================================*/
sl@0:
sl@0: /**
sl@0: * Platform utilities isolates the platform dependencies of the
sl@0: * libarary. For each platform which this code is ported to, these
sl@0: * functions may have to be re-implemented.
sl@0: */
sl@0:
sl@0: /**
sl@0: * Return the ICU data directory.
sl@0: * The data directory is where common format ICU data files (.dat files)
sl@0: * are loaded from. Note that normal use of the built-in ICU
sl@0: * facilities does not require loading of an external data file;
sl@0: * unless you are adding custom data to ICU, the data directory
sl@0: * does not need to be set.
sl@0: *
sl@0: * The data directory is determined as follows:
sl@0: * If u_setDataDirectory() has been called, that is it, otherwise
sl@0: * if the ICU_DATA environment variable is set, use that, otherwise
sl@0: * If a data directory was specifed at ICU build time
sl@0: * (#define ICU_DATA_DIR "path"), use that,
sl@0: * otherwise no data directory is available.
sl@0: *
sl@0: * @return the data directory, or an empty string ("") if no data directory has
sl@0: * been specified.
sl@0: *
sl@0: * @stable ICU 2.0
sl@0: */
sl@0: U_STABLE const char* U_EXPORT2 u_getDataDirectory(void);
sl@0:
sl@0: /**
sl@0: * Set the ICU data directory.
sl@0: * The data directory is where common format ICU data files (.dat files)
sl@0: * are loaded from. Note that normal use of the built-in ICU
sl@0: * facilities does not require loading of an external data file;
sl@0: * unless you are adding custom data to ICU, the data directory
sl@0: * does not need to be set.
sl@0: *
sl@0: * This function should be called at most once in a process, before the
sl@0: * first ICU operation (e.g., u_init()) that will require the loading of an
sl@0: * ICU data file.
sl@0: * This function is not thread-safe. Use it before calling ICU APIs from
sl@0: * multiple threads.
sl@0: *
sl@0: * @param directory The directory to be set.
sl@0: *
sl@0: * @see u_init
sl@0: * @stable ICU 2.0
sl@0: */
sl@0: U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory);
sl@0:
sl@0: /**
sl@0: * Please use ucnv_getDefaultName() instead.
sl@0: * Return the default codepage for this platform and locale.
sl@0: * This function can call setlocale() on Unix platforms. Please read the
sl@0: * platform documentation on setlocale() before calling this function.
sl@0: * @return the default codepage for this platform
sl@0: * @internal
sl@0: */
sl@0: U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void);
sl@0:
sl@0: /**
sl@0: * Please use uloc_getDefault() instead.
sl@0: * Return the default locale ID string by querying ths system, or
sl@0: * zero if one cannot be found.
sl@0: * This function can call setlocale() on Unix platforms. Please read the
sl@0: * platform documentation on setlocale() before calling this function.
sl@0: * @return the default locale ID string
sl@0: * @internal
sl@0: */
sl@0: U_INTERNAL const char* U_EXPORT2 uprv_getDefaultLocaleID(void);
sl@0:
sl@0: /**
sl@0: * Filesystem file and path separator characters.
sl@0: * Example: '/' and ':' on Unix, '\\' and ';' on Windows.
sl@0: * @stable ICU 2.0
sl@0: */
sl@0: #ifdef XP_MAC
sl@0: # define U_FILE_SEP_CHAR ':'
sl@0: # define U_FILE_ALT_SEP_CHAR ':'
sl@0: # define U_PATH_SEP_CHAR ';'
sl@0: # define U_FILE_SEP_STRING ":"
sl@0: # define U_FILE_ALT_SEP_STRING ":"
sl@0: # define U_PATH_SEP_STRING ";"
sl@0: #elif defined(U_WINDOWS)
sl@0: # define U_FILE_SEP_CHAR '\\'
sl@0: # define U_FILE_ALT_SEP_CHAR '/'
sl@0: # define U_PATH_SEP_CHAR ';'
sl@0: # define U_FILE_SEP_STRING "\\"
sl@0: # define U_FILE_ALT_SEP_STRING "/"
sl@0: # define U_PATH_SEP_STRING ";"
sl@0: #else
sl@0: # define U_FILE_SEP_CHAR '/'
sl@0: # define U_FILE_ALT_SEP_CHAR '/'
sl@0: # define U_PATH_SEP_CHAR ':'
sl@0: # define U_FILE_SEP_STRING "/"
sl@0: # define U_FILE_ALT_SEP_STRING "/"
sl@0: # define U_PATH_SEP_STRING ":"
sl@0: #endif
sl@0:
sl@0: /**
sl@0: * Convert char characters to UChar characters.
sl@0: * This utility function is useful only for "invariant characters"
sl@0: * that are encoded in the platform default encoding.
sl@0: * They are a small, constant subset of the encoding and include
sl@0: * just the latin letters, digits, and some punctuation.
sl@0: * For details, see U_CHARSET_FAMILY.
sl@0: *
sl@0: * @param cs Input string, points to length
sl@0: * character bytes from a subset of the platform encoding.
sl@0: * @param us Output string, points to memory for length
sl@0: * Unicode characters.
sl@0: * @param length The number of characters to convert; this may
sl@0: * include the terminating NUL
.
sl@0: *
sl@0: * @see U_CHARSET_FAMILY
sl@0: * @stable ICU 2.0
sl@0: */
sl@0: U_STABLE void U_EXPORT2
sl@0: u_charsToUChars(const char *cs, UChar *us, int32_t length);
sl@0:
sl@0: /**
sl@0: * Convert UChar characters to char characters.
sl@0: * This utility function is useful only for "invariant characters"
sl@0: * that can be encoded in the platform default encoding.
sl@0: * They are a small, constant subset of the encoding and include
sl@0: * just the latin letters, digits, and some punctuation.
sl@0: * For details, see U_CHARSET_FAMILY.
sl@0: *
sl@0: * @param us Input string, points to length
sl@0: * Unicode characters that can be encoded with the
sl@0: * codepage-invariant subset of the platform encoding.
sl@0: * @param cs Output string, points to memory for length
sl@0: * character bytes.
sl@0: * @param length The number of characters to convert; this may
sl@0: * include the terminating NUL
.
sl@0: *
sl@0: * @see U_CHARSET_FAMILY
sl@0: * @stable ICU 2.0
sl@0: */
sl@0: U_STABLE void U_EXPORT2
sl@0: u_UCharsToChars(const UChar *us, char *cs, int32_t length);
sl@0:
sl@0: #endif