msvcp71: Added functions for creating basic_string iterators.
[wine/multimedia.git] / dlls / msvcp71 / msvcp71.c
blobb0be17edf369067b56eb44917d7a33d86d498103
1 /*
2 * msvcp71 specific functions
4 * Copyright 2010 Piotr Caban for CodeWeavers
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 #include "config.h"
23 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
28 /* Copied from dlls/msvcrt/cpp.c */
29 #ifdef __i386__ /* thiscall functions are i386-specific */
31 #define THISCALL(func) __thiscall_ ## func
32 #define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func)
33 #define __thiscall __stdcall
34 #define DEFINE_THISCALL_WRAPPER(func,args) \
35 extern void THISCALL(func)(void); \
36 __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
37 "popl %eax\n\t" \
38 "pushl %ecx\n\t" \
39 "pushl %eax\n\t" \
40 "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
41 #else /* __i386__ */
43 #define THISCALL(func) func
44 #define THISCALL_NAME(func) __ASM_NAME(#func)
45 #define __thiscall __cdecl
46 #define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
48 #endif /* __i386__ */
50 /* Copied from dlls/msvcp90/msvcp90.h */
51 typedef SIZE_T MSVCP_size_t;
52 typedef unsigned short MSVCP_wchar_t;
54 #define BUF_SIZE_CHAR 16
55 typedef struct
57 void *allocator;
58 union {
59 char buf[BUF_SIZE_CHAR];
60 char *ptr;
61 } data;
62 MSVCP_size_t size;
63 MSVCP_size_t res;
64 } basic_string_char;
66 #define BUF_SIZE_WCHAR 8
67 typedef struct
69 void *allocator;
70 union {
71 MSVCP_wchar_t buf[BUF_SIZE_WCHAR];
72 MSVCP_wchar_t *ptr;
73 } data;
74 MSVCP_size_t size;
75 MSVCP_size_t res;
76 } basic_string_wchar;
78 typedef struct {
79 const char *pos;
80 } basic_string_char_iterator;
82 typedef struct {
83 const MSVCP_wchar_t *pos;
84 } basic_string_wchar_iterator;
86 static char* basic_string_char_ptr(basic_string_char *this)
88 if(this->res == BUF_SIZE_CHAR-1)
89 return this->data.buf;
90 return this->data.ptr;
93 static MSVCP_wchar_t* basic_string_wchar_ptr(basic_string_wchar *this)
95 if(this->res == BUF_SIZE_WCHAR-1)
96 return this->data.buf;
97 return this->data.ptr;
100 /* ?begin@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE?AViterator@12@XZ */
101 /* ?begin@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AVconst_iterator@12@XZ */
102 /* ?rend@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE?AV?$reverse_iterator@Viterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@XZ */
103 /* ?rend@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$reverse_iterator@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@XZ */
104 DEFINE_THISCALL_WRAPPER(basic_string_char_begin, 8)
105 basic_string_char_iterator* __thiscall basic_string_char_begin(
106 basic_string_char *this, basic_string_char_iterator *ret)
108 ret->pos = basic_string_char_ptr(this);
109 return ret;
112 /* ?end@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE?AViterator@12@XZ */
113 /* ?end@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AVconst_iterator@12@XZ */
114 /* ?rbegin@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE?AV?$reverse_iterator@Viterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@XZ */
115 /* ?rbegin@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$reverse_iterator@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@XZ */
116 DEFINE_THISCALL_WRAPPER(basic_string_char_end, 8)
117 basic_string_char_iterator* __thiscall basic_string_char_end(
118 basic_string_char *this, basic_string_char_iterator *ret)
120 ret->pos = basic_string_char_ptr(this)+this->size;
121 return ret;
125 /* ?begin@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE?AViterator@12@XZ */
126 /* ?begin@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AVconst_iterator@12@XZ */
127 /* ?begin@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE?AViterator@12@XZ */
128 /* ?begin@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBE?AVconst_iterator@12@XZ */
129 /* ?rend@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE?AV?$reverse_iterator@Viterator@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@2@XZ */
130 /* ?rend@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$reverse_iterator@Vconst_iterator@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@2@XZ */
131 /* ?rend@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE?AV?$reverse_iterator@Viterator@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@2@XZ */
132 /* ?rend@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBE?AV?$reverse_iterator@Vconst_iterator@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@2@XZ */
133 DEFINE_THISCALL_WRAPPER(basic_string_wchar_begin, 8)
134 basic_string_wchar_iterator* __thiscall basic_string_wchar_begin(
135 basic_string_wchar *this, basic_string_wchar_iterator *ret)
137 ret->pos = basic_string_wchar_ptr(this);
138 return ret;
141 /* ?end@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE?AViterator@12@XZ */
142 /* ?end@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AVconst_iterator@12@XZ */
143 /* ?end@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE?AViterator@12@XZ */
144 /* ?end@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBE?AVconst_iterator@12@XZ */
145 /* ?rbegin@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE?AV?$reverse_iterator@Viterator@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@2@XZ */
146 /* ?rbegin@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$reverse_iterator@Vconst_iterator@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@2@XZ */
147 /* ?rbegin@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE?AV?$reverse_iterator@Viterator@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@2@XZ */
148 /* ?rbegin@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBE?AV?$reverse_iterator@Vconst_iterator@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@2@XZ */
149 DEFINE_THISCALL_WRAPPER(basic_string_wchar_end, 8)
150 basic_string_wchar_iterator* __thiscall basic_string_wchar_end(
151 basic_string_wchar *this, basic_string_wchar_iterator *ret)
153 ret->pos = basic_string_wchar_ptr(this)+this->size;
154 return ret;
157 BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved)
159 switch (reason)
161 case DLL_WINE_PREATTACH:
162 return FALSE; /* prefer native version */
164 case DLL_PROCESS_ATTACH:
165 DisableThreadLibraryCalls(hdll);
167 return TRUE;