af062818b47340eef15700d2f0211576ba3506eevboxsync/*
af062818b47340eef15700d2f0211576ba3506eevboxsync * Wine internal Unicode definitions
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * Copyright 2000 Alexandre Julliard
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * This library is free software; you can redistribute it and/or
af062818b47340eef15700d2f0211576ba3506eevboxsync * modify it under the terms of the GNU Lesser General Public
af062818b47340eef15700d2f0211576ba3506eevboxsync * License as published by the Free Software Foundation; either
af062818b47340eef15700d2f0211576ba3506eevboxsync * version 2.1 of the License, or (at your option) any later version.
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * This library is distributed in the hope that it will be useful,
af062818b47340eef15700d2f0211576ba3506eevboxsync * but WITHOUT ANY WARRANTY; without even the implied warranty of
af062818b47340eef15700d2f0211576ba3506eevboxsync * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
af062818b47340eef15700d2f0211576ba3506eevboxsync * Lesser General Public License for more details.
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * You should have received a copy of the GNU Lesser General Public
af062818b47340eef15700d2f0211576ba3506eevboxsync * License along with this library; if not, write to the Free Software
af062818b47340eef15700d2f0211576ba3506eevboxsync * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync/*
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * a choice of LGPL license versions is made available with the language indicating
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * that LGPLv2 or any later version may be used, or where a choice of which version
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * of the LGPL is applied is otherwise unspecified.
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync */
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifndef __WINE_WINE_UNICODE_H
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __WINE_WINE_UNICODE_H
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <stdarg.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <windef.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <winbase.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <winnls.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef __WINE_WINE_TEST_H
af062818b47340eef15700d2f0211576ba3506eevboxsync#error This file should not be used in Wine tests
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef __cplusplus
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern "C" {
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifndef WINE_UNICODE_API
af062818b47340eef15700d2f0211576ba3506eevboxsync# if defined(_MSC_VER) || defined(__MINGW32__)
af062818b47340eef15700d2f0211576ba3506eevboxsync# define WINE_UNICODE_API DECLSPEC_IMPORT
af062818b47340eef15700d2f0211576ba3506eevboxsync# else
af062818b47340eef15700d2f0211576ba3506eevboxsync# define WINE_UNICODE_API
af062818b47340eef15700d2f0211576ba3506eevboxsync# endif
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/*#ifndef WINE_UNICODE_INLINE
af062818b47340eef15700d2f0211576ba3506eevboxsync#define WINE_UNICODE_INLINE extern inline
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif*/
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/* code page info common to SBCS and DBCS */
af062818b47340eef15700d2f0211576ba3506eevboxsyncstruct cp_info
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync unsigned int codepage; /* codepage id */
af062818b47340eef15700d2f0211576ba3506eevboxsync unsigned int char_size; /* char size (1 or 2 bytes) */
af062818b47340eef15700d2f0211576ba3506eevboxsync WCHAR def_char; /* default char value (can be double-byte) */
af062818b47340eef15700d2f0211576ba3506eevboxsync WCHAR def_unicode_char; /* default Unicode char value */
af062818b47340eef15700d2f0211576ba3506eevboxsync const char *name; /* code page name */
af062818b47340eef15700d2f0211576ba3506eevboxsync};
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncstruct sbcs_table
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync struct cp_info info;
af062818b47340eef15700d2f0211576ba3506eevboxsync const WCHAR *cp2uni; /* code page -> Unicode map */
af062818b47340eef15700d2f0211576ba3506eevboxsync const WCHAR *cp2uni_glyphs; /* code page -> Unicode map with glyph chars */
af062818b47340eef15700d2f0211576ba3506eevboxsync const unsigned char *uni2cp_low; /* Unicode -> code page map */
af062818b47340eef15700d2f0211576ba3506eevboxsync const unsigned short *uni2cp_high;
af062818b47340eef15700d2f0211576ba3506eevboxsync};
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncstruct dbcs_table
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync struct cp_info info;
af062818b47340eef15700d2f0211576ba3506eevboxsync const WCHAR *cp2uni; /* code page -> Unicode map */
af062818b47340eef15700d2f0211576ba3506eevboxsync const unsigned char *cp2uni_leadbytes;
af062818b47340eef15700d2f0211576ba3506eevboxsync const unsigned short *uni2cp_low; /* Unicode -> code page map */
af062818b47340eef15700d2f0211576ba3506eevboxsync const unsigned short *uni2cp_high;
af062818b47340eef15700d2f0211576ba3506eevboxsync unsigned char lead_bytes[12]; /* lead bytes ranges */
af062818b47340eef15700d2f0211576ba3506eevboxsync};
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncunion cptable
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync struct cp_info info;
af062818b47340eef15700d2f0211576ba3506eevboxsync struct sbcs_table sbcs;
af062818b47340eef15700d2f0211576ba3506eevboxsync struct dbcs_table dbcs;
af062818b47340eef15700d2f0211576ba3506eevboxsync};
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern const union cptable *wine_cp_get_table( unsigned int codepage );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern const union cptable *wine_cp_enum_table( unsigned int index );
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int wine_cp_mbstowcs( const union cptable *table, int flags,
af062818b47340eef15700d2f0211576ba3506eevboxsync const char *src, int srclen,
af062818b47340eef15700d2f0211576ba3506eevboxsync WCHAR *dst, int dstlen );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int wine_cp_wcstombs( const union cptable *table, int flags,
af062818b47340eef15700d2f0211576ba3506eevboxsync const WCHAR *src, int srclen,
af062818b47340eef15700d2f0211576ba3506eevboxsync char *dst, int dstlen, const char *defchar, int *used );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int wine_cpsymbol_mbstowcs( const char *src, int srclen, WCHAR *dst, int dstlen );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int wine_cpsymbol_wcstombs( const WCHAR *src, int srclen, char *dst, int dstlen );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int wine_utf8_mbstowcs( int flags, const char *src, int srclen, WCHAR *dst, int dstlen );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int wine_utf8_wcstombs( int flags, const WCHAR *src, int srclen, char *dst, int dstlen );
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int wine_compare_string( int flags, const WCHAR *str1, int len1, const WCHAR *str2, int len2 );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int wine_get_sortkey( int flags, const WCHAR *src, int srclen, char *dst, int dstlen );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int wine_fold_string( int flags, const WCHAR *src, int srclen , WCHAR *dst, int dstlen );
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int strcmpiW( const WCHAR *str1, const WCHAR *str2 );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int strncmpiW( const WCHAR *str1, const WCHAR *str2, int n );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int memicmpW( const WCHAR *str1, const WCHAR *str2, int n );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern WCHAR *strstrW( const WCHAR *str, const WCHAR *sub );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern long int strtolW( const WCHAR *nptr, WCHAR **endptr, int base );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern unsigned long int strtoulW( const WCHAR *nptr, WCHAR **endptr, int base );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int sprintfW( WCHAR *str, const WCHAR *format, ... );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int snprintfW( WCHAR *str, size_t len, const WCHAR *format, ... );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int vsprintfW( WCHAR *str, const WCHAR *format, va_list valist );
af062818b47340eef15700d2f0211576ba3506eevboxsyncextern int vsnprintfW( WCHAR *str, size_t len, const WCHAR *format, va_list valist );
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef WINE_UNICODE_INLINE
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int wine_is_dbcs_leadbyte( const union cptable *table, unsigned char ch );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int wine_is_dbcs_leadbyte( const union cptable *table, unsigned char ch )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return (table->info.char_size == 2) && (table->dbcs.cp2uni_leadbytes[ch]);
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR tolowerW( WCHAR ch );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR tolowerW( WCHAR ch )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync extern WINE_UNICODE_API const WCHAR wine_casemap_lower[];
af062818b47340eef15700d2f0211576ba3506eevboxsync return ch + wine_casemap_lower[wine_casemap_lower[ch >> 8] + (ch & 0xff)];
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR toupperW( WCHAR ch );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR toupperW( WCHAR ch )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync extern WINE_UNICODE_API const WCHAR wine_casemap_upper[];
af062818b47340eef15700d2f0211576ba3506eevboxsync return ch + wine_casemap_upper[wine_casemap_upper[ch >> 8] + (ch & 0xff)];
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/* the character type contains the C1_* flags in the low 12 bits */
af062818b47340eef15700d2f0211576ba3506eevboxsync/* and the C2_* type in the high 4 bits */
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE unsigned short get_char_typeW( WCHAR ch );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE unsigned short get_char_typeW( WCHAR ch )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync extern WINE_UNICODE_API const unsigned short wine_wctype_table[];
af062818b47340eef15700d2f0211576ba3506eevboxsync return wine_wctype_table[wine_wctype_table[ch >> 8] + (ch & 0xff)];
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int iscntrlW( WCHAR wc );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int iscntrlW( WCHAR wc )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return get_char_typeW(wc) & C1_CNTRL;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int ispunctW( WCHAR wc );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int ispunctW( WCHAR wc )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return get_char_typeW(wc) & C1_PUNCT;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isspaceW( WCHAR wc );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isspaceW( WCHAR wc )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return get_char_typeW(wc) & C1_SPACE;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isdigitW( WCHAR wc );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isdigitW( WCHAR wc )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return get_char_typeW(wc) & C1_DIGIT;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isxdigitW( WCHAR wc );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isxdigitW( WCHAR wc )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return get_char_typeW(wc) & C1_XDIGIT;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int islowerW( WCHAR wc );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int islowerW( WCHAR wc )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return get_char_typeW(wc) & C1_LOWER;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isupperW( WCHAR wc );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isupperW( WCHAR wc )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return get_char_typeW(wc) & C1_UPPER;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isalnumW( WCHAR wc );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isalnumW( WCHAR wc )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return get_char_typeW(wc) & (C1_ALPHA|C1_DIGIT|C1_LOWER|C1_UPPER);
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isalphaW( WCHAR wc );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isalphaW( WCHAR wc )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return get_char_typeW(wc) & (C1_ALPHA|C1_LOWER|C1_UPPER);
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isgraphW( WCHAR wc );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isgraphW( WCHAR wc )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return get_char_typeW(wc) & (C1_ALPHA|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isprintW( WCHAR wc );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int isprintW( WCHAR wc )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return get_char_typeW(wc) & (C1_ALPHA|C1_BLANK|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/* some useful string manipulation routines */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE unsigned int strlenW( const WCHAR *str );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE unsigned int strlenW( const WCHAR *str )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync const WCHAR *s = str;
af062818b47340eef15700d2f0211576ba3506eevboxsync while (*s) s++;
af062818b47340eef15700d2f0211576ba3506eevboxsync return s - str;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *strcpyW( WCHAR *dst, const WCHAR *src );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *strcpyW( WCHAR *dst, const WCHAR *src )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync WCHAR *p = dst;
af062818b47340eef15700d2f0211576ba3506eevboxsync while ((*p++ = *src++));
af062818b47340eef15700d2f0211576ba3506eevboxsync return dst;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/* strncpy doesn't do what you think, don't use it */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define strncpyW(d,s,n) error do_not_use_strncpyW_use_lstrcpynW_or_memcpy_instead
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int strcmpW( const WCHAR *str1, const WCHAR *str2 );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int strcmpW( const WCHAR *str1, const WCHAR *str2 )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync while (*str1 && (*str1 == *str2)) { str1++; str2++; }
af062818b47340eef15700d2f0211576ba3506eevboxsync return *str1 - *str2;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int strncmpW( const WCHAR *str1, const WCHAR *str2, int n );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int strncmpW( const WCHAR *str1, const WCHAR *str2, int n )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync if (n <= 0) return 0;
af062818b47340eef15700d2f0211576ba3506eevboxsync while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; }
af062818b47340eef15700d2f0211576ba3506eevboxsync return *str1 - *str2;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *strcatW( WCHAR *dst, const WCHAR *src );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *strcatW( WCHAR *dst, const WCHAR *src )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync strcpyW( dst + strlenW(dst), src );
af062818b47340eef15700d2f0211576ba3506eevboxsync return dst;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *strchrW( const WCHAR *str, WCHAR ch );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *strchrW( const WCHAR *str, WCHAR ch )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync do { if (*str == ch) return (WCHAR *)(ULONG_PTR)str; } while (*str++);
af062818b47340eef15700d2f0211576ba3506eevboxsync return NULL;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *strrchrW( const WCHAR *str, WCHAR ch );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *strrchrW( const WCHAR *str, WCHAR ch )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync WCHAR *ret = NULL;
af062818b47340eef15700d2f0211576ba3506eevboxsync do { if (*str == ch) ret = (WCHAR *)(ULONG_PTR)str; } while (*str++);
af062818b47340eef15700d2f0211576ba3506eevboxsync return ret;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync for ( ; *str; str++) if (strchrW( accept, *str )) return (WCHAR *)(ULONG_PTR)str;
af062818b47340eef15700d2f0211576ba3506eevboxsync return NULL;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE size_t strspnW( const WCHAR *str, const WCHAR *accept );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE size_t strspnW( const WCHAR *str, const WCHAR *accept )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync const WCHAR *ptr;
af062818b47340eef15700d2f0211576ba3506eevboxsync for (ptr = str; *ptr; ptr++) if (!strchrW( accept, *ptr )) break;
af062818b47340eef15700d2f0211576ba3506eevboxsync return ptr - str;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE size_t strcspnW( const WCHAR *str, const WCHAR *reject );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE size_t strcspnW( const WCHAR *str, const WCHAR *reject )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync const WCHAR *ptr;
af062818b47340eef15700d2f0211576ba3506eevboxsync for (ptr = str; *ptr; ptr++) if (strchrW( reject, *ptr )) break;
af062818b47340eef15700d2f0211576ba3506eevboxsync return ptr - str;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *strlwrW( WCHAR *str );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *strlwrW( WCHAR *str )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync WCHAR *ret = str;
af062818b47340eef15700d2f0211576ba3506eevboxsync while ((*str = tolowerW(*str))) str++;
af062818b47340eef15700d2f0211576ba3506eevboxsync return ret;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *struprW( WCHAR *str );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *struprW( WCHAR *str )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync WCHAR *ret = str;
af062818b47340eef15700d2f0211576ba3506eevboxsync while ((*str = toupperW(*str))) str++;
af062818b47340eef15700d2f0211576ba3506eevboxsync return ret;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync const WCHAR *end;
af062818b47340eef15700d2f0211576ba3506eevboxsync for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) return (WCHAR *)(ULONG_PTR)ptr;
af062818b47340eef15700d2f0211576ba3506eevboxsync return NULL;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *memrchrW( const WCHAR *ptr, WCHAR ch, size_t n );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE WCHAR *memrchrW( const WCHAR *ptr, WCHAR ch, size_t n )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync const WCHAR *end;
af062818b47340eef15700d2f0211576ba3506eevboxsync WCHAR *ret = NULL;
af062818b47340eef15700d2f0211576ba3506eevboxsync for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) ret = (WCHAR *)(ULONG_PTR)ptr;
af062818b47340eef15700d2f0211576ba3506eevboxsync return ret;
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE long int atolW( const WCHAR *str );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE long int atolW( const WCHAR *str )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return strtolW( str, (WCHAR **)0, 10 );
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int atoiW( const WCHAR *str );
af062818b47340eef15700d2f0211576ba3506eevboxsyncWINE_UNICODE_INLINE int atoiW( const WCHAR *str )
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync return (int)atolW( str );
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif //#ifdef WINE_UNICODE_INLINE
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#undef WINE_UNICODE_INLINE
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef __cplusplus
af062818b47340eef15700d2f0211576ba3506eevboxsync}
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif /* __WINE_WINE_UNICODE_H */