1 | /*
|
---|
2 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
3 | *
|
---|
4 | * Win32 compatibility string functions for OS/2
|
---|
5 | *
|
---|
6 | * Copyright 1999 Patrick Haller
|
---|
7 | */
|
---|
8 |
|
---|
9 | #include <odin.h>
|
---|
10 |
|
---|
11 | #include <wine\unicode.h>
|
---|
12 | //SvL: strcase -> case insensitive!
|
---|
13 | #define strncasecmp lstrncmpiA
|
---|
14 | #define strcasecmp lstrcmpiA
|
---|
15 | #define strncmpiW lstrncmpiW
|
---|
16 | #define _strlwr(a) strlwr(a)
|
---|
17 |
|
---|
18 |
|
---|
19 | /*****************************************************************************
|
---|
20 | * Prototypes *
|
---|
21 | *****************************************************************************/
|
---|
22 | #ifdef __cplusplus
|
---|
23 | extern "C" {
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | int WIN32API lstrlenA (LPCSTR arg1);
|
---|
27 | int WIN32API lstrlenW (LPCWSTR arg1);
|
---|
28 | LPSTR WIN32API lstrcatA (LPSTR arg1, LPCSTR arg2);
|
---|
29 | LPWSTR WIN32API lstrcatW (LPWSTR arg1, LPCWSTR arg2);
|
---|
30 | int WIN32API lstrcmpA (LPCSTR arg1, LPCSTR arg2);
|
---|
31 | int WIN32API lstrcmpW (LPCWSTR arg1, LPCWSTR arg2);
|
---|
32 | int WIN32API lstrncmpA (LPCSTR arg1, LPCSTR arg2, int i);
|
---|
33 | int WIN32API lstrncmpW (LPCWSTR arg1, LPCWSTR arg2, int i);
|
---|
34 | int WIN32API lstrncmpiA (LPCSTR arg1, LPCSTR arg2, int i);
|
---|
35 | int WIN32API lstrncmpiW (LPCWSTR arg1, LPCWSTR arg2, int i);
|
---|
36 | #define lstrcmpniW lstrncmpiW
|
---|
37 | LPSTR WIN32API lstrcpyA (LPSTR arg1, LPCSTR arg2);
|
---|
38 | LPWSTR WIN32API lstrcpyW (LPWSTR dest, LPCWSTR src);
|
---|
39 | LPSTR WIN32API lstrcpynA (LPSTR arg1, LPCSTR arg2, int arg3);
|
---|
40 | LPWSTR WIN32API lstrcpynW (LPWSTR dest, LPCWSTR src, int arg3);
|
---|
41 | int WIN32API lstrcmpiA (LPCSTR arg1, LPCSTR arg2);
|
---|
42 | int WIN32API lstrcmpiW (LPCWSTR arg1, LPCWSTR arg2);
|
---|
43 | int WIN32API lstrcpynAtoW (LPWSTR unicode, LPCSTR ascii, int unilen);
|
---|
44 | int WIN32API lstrcpynWtoA (LPSTR ascii, LPCWSTR unicode, int asciilen);
|
---|
45 | LPSTR WIN32API lstrcpyWtoA (LPSTR ascii, LPCWSTR unicode);
|
---|
46 | LPWSTR WIN32API lstrcpyAtoW (LPWSTR unicode, LPCSTR ascii);
|
---|
47 | int WIN32API lstrlenWtoA ( LPCWSTR ustring, int ulen );
|
---|
48 | int WIN32API lstrlenAtoW ( LPCSTR astring, int alen );
|
---|
49 |
|
---|
50 | LPVOID WIN32API HEAP_xalloc ( HANDLE heap, DWORD flags, DWORD size );
|
---|
51 | LPVOID WIN32API HEAP_xrealloc ( HANDLE heap, DWORD flags, LPVOID lpMem, DWORD size );
|
---|
52 | LPVOID WIN32API HEAP_malloc ( DWORD size );
|
---|
53 | LPVOID WIN32API HEAP_realloc ( LPVOID lpMem, DWORD size );
|
---|
54 | DWORD WIN32API HEAP_size ( LPVOID lpMem );
|
---|
55 | BOOL WIN32API HEAP_free ( LPVOID lpMem );
|
---|
56 |
|
---|
57 | LPSTR WIN32API HEAP_strdupA ( HANDLE heap, DWORD flags, LPCSTR str );
|
---|
58 | LPWSTR WIN32API HEAP_strdupW ( HANDLE heap, DWORD flags, LPCWSTR str );
|
---|
59 | LPWSTR WIN32API HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str );
|
---|
60 | LPSTR WIN32API HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str );
|
---|
61 |
|
---|
62 | INT WIN32API WideCharToLocal(LPSTR pLocal, LPWSTR pWide, INT dwChars);
|
---|
63 | INT WIN32API LocalToWideChar(LPWSTR pWide, LPSTR pLocal, INT dwChars);
|
---|
64 |
|
---|
65 | #ifdef __cplusplus
|
---|
66 | }
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | /*****************************************************************************
|
---|
70 | * Special accelerator macros (avoid heap trashing) *
|
---|
71 | *****************************************************************************/
|
---|
72 |
|
---|
73 | #ifdef __WIN32OS2__
|
---|
74 |
|
---|
75 | #ifndef CP_ACP
|
---|
76 | // from include/win/winnls.h
|
---|
77 | #define CP_ACP 0
|
---|
78 | #endif
|
---|
79 |
|
---|
80 | #define STACK_strdupAtoW(strA,strW) \
|
---|
81 | if (!strA) strW = NULL; \
|
---|
82 | else \
|
---|
83 | { \
|
---|
84 | int len = MultiByteToWideChar( CP_ACP, 0, strA, -1, NULL, 0); \
|
---|
85 | strW = (LPWSTR)_alloca( len*sizeof(WCHAR) ); \
|
---|
86 | MultiByteToWideChar(CP_ACP, 0, strA, -1, strW, len); \
|
---|
87 | }
|
---|
88 |
|
---|
89 | #define STACK_strdupWtoA(strW,strA) \
|
---|
90 | if (!strW) strA = NULL; \
|
---|
91 | else \
|
---|
92 | { \
|
---|
93 | int len = WideCharToMultiByte( CP_ACP, 0, strW, -1, NULL, 0, 0, NULL);\
|
---|
94 | strA = (LPSTR)_alloca(len); \
|
---|
95 | WideCharToMultiByte(CP_ACP, 0, strW, -1, strA, len, 0, NULL ); \
|
---|
96 | }
|
---|
97 |
|
---|
98 | #define STACK_strdupA(strDest, strSrc) \
|
---|
99 | { \
|
---|
100 | int iLength = lstrlenA(strSrc) + 1; \
|
---|
101 | strDest = (LPSTR)_alloca( iLength ); \
|
---|
102 | memcpy( strDest, strSrc, iLength); \
|
---|
103 | }
|
---|
104 |
|
---|
105 | #define STACK_strdupW(strDest, strSrc) \
|
---|
106 | { \
|
---|
107 | int iLength = lstrlenW(strSrc) + 1; \
|
---|
108 | strDest = (LPWSTR)_alloca( iLength * sizeof(WCHAR) ); \
|
---|
109 | memcpy( strDest, strSrc, iLength * sizeof(WCHAR) ); \
|
---|
110 | }
|
---|
111 |
|
---|
112 |
|
---|
113 | #endif
|
---|
114 |
|
---|