msvcrt: Avoid locking the file in _fclose_nolock.
[wine.git] / dlls / msvcp60 / misc.c
bloba54fd28bd210360247d53ad3b44703c2d2d29346
1 /*
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
19 #include "config.h"
21 #include <stdarg.h>
22 #include <limits.h>
24 #include "msvcp.h"
26 #include "windef.h"
27 #include "winbase.h"
30 static CRITICAL_SECTION lockit_cs;
32 void init_lockit(void) {
33 InitializeCriticalSection(&lockit_cs);
34 lockit_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": _Lockit critical section");
37 void free_lockit(void) {
38 lockit_cs.DebugInfo->Spare[0] = 0;
39 DeleteCriticalSection(&lockit_cs);
42 _Lockit* __thiscall _Lockit_ctor_locktype(_Lockit *this, int locktype)
44 EnterCriticalSection(&lockit_cs);
45 return this;
48 /* ??0_Lockit@std@@QAE@XZ */
49 /* ??0_Lockit@std@@QEAA@XZ */
50 DEFINE_THISCALL_WRAPPER(_Lockit_ctor, 4)
51 _Lockit* __thiscall _Lockit_ctor(_Lockit *this)
53 return _Lockit_ctor_locktype(this, 0);
56 /* ??1_Lockit@std@@QAE@XZ */
57 /* ??1_Lockit@std@@QEAA@XZ */
58 DEFINE_THISCALL_WRAPPER(_Lockit_dtor, 4)
59 void __thiscall _Lockit_dtor(_Lockit *this)
61 LeaveCriticalSection(&lockit_cs);
64 /* wctype */
65 unsigned short __cdecl wctype(const char *property)
67 static const struct {
68 const char *name;
69 unsigned short mask;
70 } properties[] = {
71 { "alnum", _DIGIT|_ALPHA },
72 { "alpha", _ALPHA },
73 { "cntrl", _CONTROL },
74 { "digit", _DIGIT },
75 { "graph", _DIGIT|_PUNCT|_ALPHA },
76 { "lower", _LOWER },
77 { "print", _DIGIT|_PUNCT|_BLANK|_ALPHA },
78 { "punct", _PUNCT },
79 { "space", _SPACE },
80 { "upper", _UPPER },
81 { "xdigit", _HEX }
83 unsigned int i;
85 for(i=0; i<sizeof(properties)/sizeof(properties[0]); i++)
86 if(!strcmp(property, properties[i].name))
87 return properties[i].mask;
89 return 0;