86 lines
2.7 KiB
C
86 lines
2.7 KiB
C
/*
|
|
* Wine internal Unicode definitions
|
|
*
|
|
* Copyright 2000 Alexandre Julliard
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
*/
|
|
|
|
#ifndef __WINE_UNICODE_H
|
|
#define __WINE_UNICODE_H
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <windef.h>
|
|
#include <winbase.h>
|
|
#include <winnls.h>
|
|
|
|
/* code page info common to SBCS and DBCS */
|
|
struct cp_info
|
|
{
|
|
unsigned int codepage; /* codepage id */
|
|
unsigned int char_size; /* char size (1 or 2 bytes) */
|
|
WCHAR def_char; /* default char value (can be double-byte) */
|
|
WCHAR def_unicode_char; /* default Unicode char value */
|
|
const char *name; /* code page name */
|
|
};
|
|
|
|
struct sbcs_table
|
|
{
|
|
struct cp_info info;
|
|
const WCHAR *cp2uni; /* code page -> Unicode map */
|
|
const WCHAR *cp2uni_glyphs; /* code page -> Unicode map with glyph chars */
|
|
const unsigned char *uni2cp_low; /* Unicode -> code page map */
|
|
const unsigned short *uni2cp_high;
|
|
};
|
|
|
|
struct dbcs_table
|
|
{
|
|
struct cp_info info;
|
|
const WCHAR *cp2uni; /* code page -> Unicode map */
|
|
const unsigned char *cp2uni_leadbytes;
|
|
const unsigned short *uni2cp_low; /* Unicode -> code page map */
|
|
const unsigned short *uni2cp_high;
|
|
unsigned char lead_bytes[12]; /* lead bytes ranges */
|
|
};
|
|
|
|
union cptable
|
|
{
|
|
struct cp_info info;
|
|
struct sbcs_table sbcs;
|
|
struct dbcs_table dbcs;
|
|
};
|
|
|
|
static inline unsigned int strlenW( const WCHAR *str )
|
|
{
|
|
const WCHAR *s = str;
|
|
while (*s) s++;
|
|
return s - str;
|
|
}
|
|
|
|
static inline unsigned short get_char_typeW( WCHAR ch )
|
|
{
|
|
extern const unsigned short wine_wctype_table[];
|
|
return wine_wctype_table[wine_wctype_table[ch >> 8] + (ch & 0xff)];
|
|
}
|
|
|
|
static inline WCHAR tolowerW( WCHAR ch )
|
|
{
|
|
extern const WCHAR wine_casemap_lower[];
|
|
return ch + wine_casemap_lower[wine_casemap_lower[ch >> 8] + (ch & 0xff)];
|
|
}
|
|
|
|
#endif /* __WINE_UNICODE_H */
|