Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
5051020e
Commit
5051020e
authored
Dec 19, 2000
by
François Gouget
Committed by
Alexandre Julliard
Dec 19, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added better support for Unicode:
Added support for 16-bit wchar_t Added support for rewriting 4-byte Unicode literals to 16bit Unicode
parent
97591400
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
13 deletions
+75
-13
tchar.h
include/tchar.h
+2
-1
winnt.h
include/winnt.h
+33
-5
wtypes.h
include/wtypes.h
+8
-7
port.c
library/port.c
+32
-0
No files found.
include/tchar.h
View file @
5051020e
...
...
@@ -245,10 +245,11 @@ char *CRTDLL__strrev(char *string);
#define _vsntprintf WINE_tchar_routine(_vsnprintf, _vsnprintf, _vsnwprintf)
#define _vstprintf WINE_tchar_routine(vsprintf, vsprintf, vswprintf)
#define _vtprintf WINE_tchar_routine(vprintf, vprintf, vwprintf)
#define _TEOF WINE_tchar_routine(EOF, EOF, WEOF)
#define __T(x) __TEXT(x)
#define _T(x) __T(x)
#define _TEXT(x) __T(x)
#define __T(x) x
typedef
CHAR
_TCHARA
;
typedef
WCHAR
_TCHARW
;
...
...
include/winnt.h
View file @
5051020e
...
...
@@ -12,6 +12,7 @@
#ifndef RC_INVOKED
#include <ctype.h>
#include <string.h>
#include <stddef.h>
#endif
...
...
@@ -227,11 +228,16 @@ typedef double DATE;
typedef
VOID
*
PVOID
,
*
LPVOID
;
typedef
BYTE
BOOLEAN
,
*
PBOOLEAN
;
typedef
char
CHAR
,
*
PCHAR
;
/* Some systems might have wchar_t, but we really need 16 bit characters */
typedef
unsigned
short
WCHAR
,
*
PWCHAR
;
typedef
short
SHORT
,
*
PSHORT
;
typedef
long
LONG
,
*
PLONG
,
*
LPLONG
;
/* Some systems might have wchar_t, but we really need 16 bit characters */
#ifdef WINE_UNICODE_NATIVE
typedef
wchar_t
WCHAR
,
*
PWCHAR
;
#else
typedef
unsigned
short
WCHAR
,
*
PWCHAR
;
#endif
/* 'Extended/Wide' numerical types */
#ifndef _ULONGLONG_
#define _ULONGLONG_
...
...
@@ -257,24 +263,46 @@ typedef WCHAR *PWSTR, *LPWSTR;
typedef
const
WCHAR
*
PCWSTR
,
*
LPCWSTR
;
/* Neutral character and string types */
/* These are only defined for Wine
L
ib, i.e. _not_ defined for
/* These are only defined for Wine
l
ib, i.e. _not_ defined for
* the emulator. The reason is they depend on the UNICODE
* macro which only exists in the user's code.
*/
#ifndef __WINE__
# ifdef WINE_UNICODE_REWRITE
EXTERN_C
unsigned
short
*
wine_rewrite_s4tos2
(
const
wchar_t
*
str4
);
# ifdef __cplusplus
inline
WCHAR
*
wine_unicode_text
(
const
wchar_t
*
str4
)
{
return
(
WCHAR
*
)
wine_rewrite_s4tos2
(
str4
);
}
inline
WCHAR
wine_unicode_text
(
wchar_t
chr4
)
{
return
(
WCHAR
)
chr4
;
}
# define WINE_UNICODE_TEXT(x) wine_unicode_text(L##x)
# else
/* __cplusplus */
# define WINE_UNICODE_TEXT(x) ((sizeof(x)==1) || (sizeof(L##x)>4) ? \
(WCHAR*)wine_rewrite_s4tos2(L##x) : \
((WCHAR)L##x))
# endif
/* __cplusplus */
# else
/* WINE_UNICODE_REWRITE */
/* WINE_UNICODE_NATIVE or nothing at all */
# define WINE_UNICODE_TEXT(string) L##string
# endif
/* WINE_UNICODE_REWRITE */
# ifdef UNICODE
typedef
WCHAR
TCHAR
,
*
PTCHAR
;
typedef
LPWSTR
PTSTR
,
LPTSTR
;
typedef
LPCWSTR
PCTSTR
,
LPCTSTR
;
# define __TEXT(string)
L##string
/*probably wrong */
# define __TEXT(string)
WINE_UNICODE_TEXT(string)
# else
/* UNICODE */
typedef
CHAR
TCHAR
,
*
PTCHAR
;
typedef
LPSTR
PTSTR
,
LPTSTR
;
typedef
LPCSTR
PCTSTR
,
LPCTSTR
;
# define __TEXT(string) string
# endif
/* UNICODE */
# define TEXT(quote) __TEXT(quote)
#endif
/* __WINE__ */
#define TEXT(quote) __TEXT(quote)
/* Misc common WIN32 types */
typedef
LONG
HRESULT
;
...
...
include/wtypes.h
View file @
5051020e
...
...
@@ -20,11 +20,14 @@ typedef OLECHAR16 *BSTR16;
typedef
BSTR16
*
LPBSTR16
;
#define OLESTR16(x) x
typedef
WCHAR
OLECHAR
;
typedef
LPWSTR
LPOLESTR
;
typedef
LPCWSTR
LPCOLESTR
;
typedef
OLECHAR
*
BSTR
;
typedef
BSTR
*
LPBSTR
;
typedef
WCHAR
OLECHAR
;
typedef
LPWSTR
LPOLESTR
;
typedef
LPCWSTR
LPCOLESTR
;
typedef
OLECHAR
*
BSTR
;
typedef
BSTR
*
LPBSTR
;
#ifndef __WINE__
#define OLESTR(str) WINE_UNICODE_TEXT(str)
#endif
#ifndef _DWORDLONG_
#define _DWORDLONG_
...
...
@@ -37,8 +40,6 @@ typedef __int64 LONGLONG, *PLONGLONG;
typedef
__uint64
ULONGLONG
,
*
PULONGLONG
;
#endif
#define OLESTR(x) L##x
typedef
enum
tagDVASPECT
{
DVASPECT_CONTENT
=
1
,
...
...
library/port.c
View file @
5051020e
...
...
@@ -23,6 +23,7 @@
#include <errno.h>
#include <fcntl.h>
#include <termios.h>
#include <wchar.h>
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
...
...
@@ -526,3 +527,34 @@ int wine_dlclose( void *handle, char *error, int errorsize )
return
1
;
#endif
}
/***********************************************************************
* wine_rewrite_s4tos2
*
* Convert 4 byte Unicode strings to 2 byte Unicode strings in-place.
* This is only practical if literal strings are writable.
*/
unsigned
short
*
wine_rewrite_s4tos2
(
const
wchar_t
*
str4
)
{
unsigned
short
*
str2
,
*
s2
;
if
(
str4
==
NULL
)
return
NULL
;
if
((
*
str4
&
0xffff0000
)
!=
0
)
{
/* This string has already been converted. Return it as is */
return
(
unsigned
short
*
)
str4
;
}
/* Note that we can also end up here if the string has a single
* character. In such a case we will convert the string over and
* over again. But this is harmless.
*/
str2
=
s2
=
(
unsigned
short
*
)
str4
;
do
{
*
s2
=
(
unsigned
short
)
*
str4
;
s2
++
;
}
while
(
*
str4
++
!=
L'\0'
);
return
str2
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment