dinput/tests: Support test IOCTLs on the bus control interface.
[wine.git] / libs / wine / unicode.h
blob4e7f53aeefaa7c85f09cce905a3ed1c2b4e59d45
1 /*
2 * Wine internal Unicode definitions
4 * Copyright 2000 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_UNICODE_H
22 #define __WINE_UNICODE_H
24 #include <stdarg.h>
26 #include <windef.h>
27 #include <winbase.h>
28 #include <winnls.h>
30 /* code page info common to SBCS and DBCS */
31 struct cp_info
33 unsigned int codepage; /* codepage id */
34 unsigned int char_size; /* char size (1 or 2 bytes) */
35 WCHAR def_char; /* default char value (can be double-byte) */
36 WCHAR def_unicode_char; /* default Unicode char value */
37 const char *name; /* code page name */
40 struct sbcs_table
42 struct cp_info info;
43 const WCHAR *cp2uni; /* code page -> Unicode map */
44 const WCHAR *cp2uni_glyphs; /* code page -> Unicode map with glyph chars */
45 const unsigned char *uni2cp_low; /* Unicode -> code page map */
46 const unsigned short *uni2cp_high;
49 struct dbcs_table
51 struct cp_info info;
52 const WCHAR *cp2uni; /* code page -> Unicode map */
53 const unsigned char *cp2uni_leadbytes;
54 const unsigned short *uni2cp_low; /* Unicode -> code page map */
55 const unsigned short *uni2cp_high;
56 unsigned char lead_bytes[12]; /* lead bytes ranges */
59 union cptable
61 struct cp_info info;
62 struct sbcs_table sbcs;
63 struct dbcs_table dbcs;
66 static inline unsigned int strlenW( const WCHAR *str )
68 const WCHAR *s = str;
69 while (*s) s++;
70 return s - str;
73 static inline unsigned short get_char_typeW( WCHAR ch )
75 extern const unsigned short wine_wctype_table[];
76 return wine_wctype_table[wine_wctype_table[ch >> 8] + (ch & 0xff)];
79 static inline WCHAR tolowerW( WCHAR ch )
81 extern const WCHAR wine_casemap_lower[];
82 return ch + wine_casemap_lower[wine_casemap_lower[ch >> 8] + (ch & 0xff)];
85 #endif /* __WINE_UNICODE_H */