2 * Copyright 2010 Piotr Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 /* ??0_Mutex@std@@QAE@XZ */
31 /* ??0_Mutex@std@@QEAA@XZ */
32 mutex* mutex_ctor(mutex *this)
34 CRITICAL_SECTION *cs = MSVCRT_operator_new(sizeof(*cs));
36 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
38 InitializeCriticalSection(cs);
39 cs->DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": _Mutex critical section");
44 /* ??1_Mutex@std@@QAE@XZ */
45 /* ??1_Mutex@std@@QEAA@XZ */
46 void mutex_dtor(mutex *this)
48 ((CRITICAL_SECTION*)this->mutex)->DebugInfo->Spare[0] = 0;
49 DeleteCriticalSection(this->mutex);
50 MSVCRT_operator_delete(this->mutex);
53 /* ?_Lock@_Mutex@std@@QAEXXZ */
54 /* ?_Lock@_Mutex@std@@QEAAXXZ */
55 void mutex_lock(mutex *this)
57 EnterCriticalSection(this->mutex);
60 /* ?_Unlock@_Mutex@std@@QAEXXZ */
61 /* ?_Unlock@_Mutex@std@@QEAAXXZ */
62 void mutex_unlock(mutex *this)
64 LeaveCriticalSection(this->mutex);
67 static CRITICAL_SECTION lockit_cs;
69 void init_lockit(void) {
70 InitializeCriticalSection(&lockit_cs);
71 lockit_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": _Lockit critical section");
74 void free_lockit(void) {
75 lockit_cs.DebugInfo->Spare[0] = 0;
76 DeleteCriticalSection(&lockit_cs);
79 _Lockit* __thiscall _Lockit_ctor_locktype(_Lockit *this, int locktype)
81 EnterCriticalSection(&lockit_cs);
85 /* ??0_Lockit@std@@QAE@XZ */
86 /* ??0_Lockit@std@@QEAA@XZ */
87 DEFINE_THISCALL_WRAPPER(_Lockit_ctor, 4)
88 _Lockit* __thiscall _Lockit_ctor(_Lockit *this)
90 return _Lockit_ctor_locktype(this, 0);
93 /* ??1_Lockit@std@@QAE@XZ */
94 /* ??1_Lockit@std@@QEAA@XZ */
95 DEFINE_THISCALL_WRAPPER(_Lockit_dtor, 4)
96 void __thiscall _Lockit_dtor(_Lockit *this)
98 LeaveCriticalSection(&lockit_cs);
102 unsigned short __cdecl wctype(const char *property)
104 static const struct {
108 { "alnum", _DIGIT|_ALPHA },
110 { "cntrl", _CONTROL },
112 { "graph", _DIGIT|_PUNCT|_ALPHA },
114 { "print", _DIGIT|_PUNCT|_BLANK|_ALPHA },
122 for(i=0; i<sizeof(properties)/sizeof(properties[0]); i++)
123 if(!strcmp(property, properties[i].name))
124 return properties[i].mask;